mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-06 02:52:41 +01:00
Fixed: Newznab parser will attempt to use the usenetdate for age determination instead of the feed publish date.
This commit is contained in:
parent
9916479f02
commit
c04ae9f1d0
@ -3,6 +3,7 @@
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System.Globalization;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
@ -19,6 +20,21 @@ protected override string GetNzbInfoUrl(XElement item)
|
||||
return item.Comments().Replace("#comments", "");
|
||||
}
|
||||
|
||||
protected override DateTime GetPublishDate(XElement item)
|
||||
{
|
||||
var attributes = item.Elements("attr").ToList();
|
||||
var usenetdateElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("usenetdate", StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
if (usenetdateElement != null)
|
||||
{
|
||||
var dateString = usenetdateElement.Attribute("value").Value;
|
||||
|
||||
return XElementExtensions.ParseDate(dateString);
|
||||
}
|
||||
|
||||
return base.GetPublishDate(item);
|
||||
}
|
||||
|
||||
protected override long GetSize(XElement item)
|
||||
{
|
||||
var attributes = item.Elements("attr").ToList();
|
||||
|
@ -35,10 +35,8 @@ public static XElement StripNameSpace(this XElement root)
|
||||
return res;
|
||||
}
|
||||
|
||||
public static DateTime PublishDate(this XElement item)
|
||||
public static DateTime ParseDate(string dateString)
|
||||
{
|
||||
string dateString = item.TryGetValue("pubDate");
|
||||
|
||||
try
|
||||
{
|
||||
DateTime result;
|
||||
@ -56,6 +54,13 @@ public static DateTime PublishDate(this XElement item)
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime PublishDate(this XElement item)
|
||||
{
|
||||
string dateString = item.TryGetValue("pubDate");
|
||||
|
||||
return ParseDate(dateString);
|
||||
}
|
||||
|
||||
public static List<String> Links(this XElement item)
|
||||
{
|
||||
var elements = item.Elements("link");
|
||||
|
Loading…
Reference in New Issue
Block a user