mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
Fixed: Category parsing for some not-so-great Torznab feeds
MoreThanTv
This commit is contained in:
@@ -127,6 +127,12 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
var cats = TryGetMultipleNewznabAttributes(item, "category");
|
||||
var results = new List<IndexerCategory>();
|
||||
|
||||
// Try to find <category> elements for some indexers that suck at following the rules.
|
||||
if (results.Count == 0)
|
||||
{
|
||||
cats = item.Elements("category").Select(e => e.Value).ToList();
|
||||
}
|
||||
|
||||
foreach (var cat in cats)
|
||||
{
|
||||
var indexerCat = capabilities.Categories.MapTrackerCatToNewznab(cat);
|
||||
|
||||
@@ -165,9 +165,15 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
protected override ICollection<IndexerCategory> GetCategory(XElement item)
|
||||
{
|
||||
var capabilities = _capabilitiesProvider.GetCapabilities(_settings, _definition);
|
||||
var cats = TryGetMultipleNewznabAttributes(item, "category");
|
||||
var cats = TryGetMultipleTorznabAttributes(item, "category");
|
||||
var results = new List<IndexerCategory>();
|
||||
|
||||
// Try to find <category> elements for some indexers that suck at following the rules.
|
||||
if (results.Count == 0)
|
||||
{
|
||||
cats = item.Elements("category").Select(e => e.Value).ToList();
|
||||
}
|
||||
|
||||
foreach (var cat in cats)
|
||||
{
|
||||
var indexerCat = capabilities.Categories.MapTrackerCatToNewznab(cat);
|
||||
@@ -265,7 +271,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
protected List<string> TryGetMultipleNewznabAttributes(XElement item, string key)
|
||||
protected List<string> TryGetMultipleTorznabAttributes(XElement item, string key)
|
||||
{
|
||||
var attrElements = item.Elements(ns + "attr").Where(e => e.Attribute("name").Value.Equals(key, StringComparison.OrdinalIgnoreCase));
|
||||
var results = new List<string>();
|
||||
|
||||
Reference in New Issue
Block a user