New: Detect audio vs text from newznab categories

This commit is contained in:
ta264
2021-05-26 22:09:31 +01:00
parent 065f03a01a
commit 3abda061ba
9 changed files with 72 additions and 10 deletions
@@ -121,6 +121,25 @@ namespace NzbDrone.Core.Indexers.Newznab
return base.GetPublishDate(item);
}
protected override List<int> GetCategories(XElement item)
{
var values = item.Elements(ns + "attr")
.Where(e => e.Attribute("name").Value.Equals("category", StringComparison.OrdinalIgnoreCase) &&
e.Attribute("value")?.Value != null)
.Select(e => e.Attribute("value").Value);
var cats = new List<int>();
foreach (var value in values)
{
if (int.TryParse(value, out var cat))
{
cats.Add(cat);
}
}
return cats;
}
protected virtual string GetAuthor(XElement item)
{
var authorString = TryGetNewznabAttribute(item, "author");