mirror of https://github.com/Radarr/Radarr
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.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using System.Globalization;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
|
@ -19,6 +20,21 @@ namespace NzbDrone.Core.Indexers.Newznab
|
|||
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 @@ namespace NzbDrone.Core.Indexers
|
|||
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 @@ namespace NzbDrone.Core.Indexers
|
|||
}
|
||||
}
|
||||
|
||||
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