diff --git a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs index 7768751c4..9aac83bed 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Headphones/HeadphonesRssParser.cs @@ -126,6 +126,28 @@ namespace NzbDrone.Core.Indexers.Headphones return results; } + protected override List GetLanguages(XElement item) + { + var languges = TryGetMultipleNewznabAttributes(item, "language"); + var results = new List(); + + // Try to find elements for some indexers that suck at following the rules. + if (languges.Count == 0) + { + languges = item.Elements("language").Select(e => e.Value).ToList(); + } + + foreach (var language in languges) + { + if (language.IsNotNullOrWhiteSpace()) + { + results.Add(language); + } + } + + return results; + } + protected override long GetSize(XElement item) { long size; diff --git a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs index 1f4388b87..85783338b 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Newznab/NewznabRssParser.cs @@ -154,6 +154,28 @@ namespace NzbDrone.Core.Indexers.Newznab return results; } + protected override List GetLanguages(XElement item) + { + var languges = TryGetMultipleNewznabAttributes(item, "language"); + var results = new List(); + + // Try to find elements for some indexers that suck at following the rules. + if (languges.Count == 0) + { + languges = item.Elements("language").Select(e => e.Value).ToList(); + } + + foreach (var language in languges) + { + if (language.IsNotNullOrWhiteSpace()) + { + results.Add(language); + } + } + + return results; + } + protected override long GetSize(XElement item) { long size; diff --git a/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs index 953ec9f21..4630916bf 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Torznab/TorznabRssParser.cs @@ -125,6 +125,28 @@ namespace NzbDrone.Core.Indexers.Torznab return ParseUrl(item.TryGetValue("comments")); } + protected override List GetLanguages(XElement item) + { + var languges = TryGetMultipleTorznabAttributes(item, "language"); + var results = new List(); + + // Try to find elements for some indexers that suck at following the rules. + if (languges.Count == 0) + { + languges = item.Elements("language").Select(e => e.Value).ToList(); + } + + foreach (var language in languges) + { + if (language.IsNotNullOrWhiteSpace()) + { + results.Add(language); + } + } + + return results; + } + protected override long GetSize(XElement item) { long size; diff --git a/src/NzbDrone.Core/Indexers/RssParser.cs b/src/NzbDrone.Core/Indexers/RssParser.cs index b24a92020..6994bb626 100644 --- a/src/NzbDrone.Core/Indexers/RssParser.cs +++ b/src/NzbDrone.Core/Indexers/RssParser.cs @@ -166,6 +166,7 @@ namespace NzbDrone.Core.Indexers releaseInfo.InfoUrl = GetInfoUrl(item); releaseInfo.CommentUrl = GetCommentUrl(item); releaseInfo.Categories = GetCategory(item); + releaseInfo.Languages = GetLanguages(item); try { @@ -237,6 +238,11 @@ namespace NzbDrone.Core.Indexers return ParseUrl((string)item.Element("comments")); } + protected virtual List GetLanguages(XElement item) + { + return new List(); + } + protected virtual long GetSize(XElement item) { if (UseEnclosureLength)