mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-27 22:56:45 -04:00
New: Detect audio vs text from newznab categories
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -159,6 +159,7 @@ namespace NzbDrone.Core.Indexers
|
||||
releaseInfo.BasicAuthString = GetBasicAuth();
|
||||
releaseInfo.InfoUrl = GetInfoUrl(item);
|
||||
releaseInfo.CommentUrl = GetCommentUrl(item);
|
||||
releaseInfo.Categories = GetCategories(item);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -230,6 +231,11 @@ namespace NzbDrone.Core.Indexers
|
||||
return ParseUrl((string)item.Element("comments"));
|
||||
}
|
||||
|
||||
protected virtual List<int> GetCategories(XElement item)
|
||||
{
|
||||
return new List<int>();
|
||||
}
|
||||
|
||||
protected virtual long GetSize(XElement item)
|
||||
{
|
||||
if (UseEnclosureLength)
|
||||
|
||||
@@ -91,9 +91,23 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
return size;
|
||||
}
|
||||
|
||||
protected override DateTime GetPublishDate(XElement item)
|
||||
protected override List<int> GetCategories(XElement item)
|
||||
{
|
||||
return base.GetPublishDate(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 override string GetDownloadUrl(XElement item)
|
||||
|
||||
Reference in New Issue
Block a user