diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index d80625690..ffe9336e7 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -53,6 +53,7 @@ public void parse_feed_xml(string fileName) parseResults.Should().NotBeEmpty(); parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name); parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString)); + parseResults.Should().OnlyContain(s => s.Age >= 0); } private void WithConfiguredIndexers() diff --git a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs index affcee148..7b2f2679b 100644 --- a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs +++ b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs @@ -218,6 +218,7 @@ private List Fetch(IEnumerable urls) public EpisodeParseResult ParseFeed(SyndicationItem item) { var episodeParseResult = Parser.ParseTitle(item.Title.Text); + if (episodeParseResult != null) episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days; return CustomParser(item, episodeParseResult); } diff --git a/NzbDrone.Core/Providers/Indexer/Newzbin.cs b/NzbDrone.Core/Providers/Indexer/Newzbin.cs index b6be66d94..f5c5e0d39 100644 --- a/NzbDrone.Core/Providers/Indexer/Newzbin.cs +++ b/NzbDrone.Core/Providers/Indexer/Newzbin.cs @@ -112,13 +112,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode var sizeString = Regex.Match(item.Summary.Text, @"\(Size: \d*\,?\d+\.\d{1,2}\w{2}\)", RegexOptions.IgnoreCase).Value; currentResult.Size = Parser.GetReportSize(sizeString); - - var dateString = Regex.Match(item.Summary.Text, - @"(?:\PostDate\:\s)(?.+?(AM|PM))(?:\s[a-zA-Z]+)(?:\<\/li\>)", - RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value; - - currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days; } + return currentResult; } diff --git a/NzbDrone.Core/Providers/Indexer/Newznab.cs b/NzbDrone.Core/Providers/Indexer/Newznab.cs index 09b86fd11..a9e625cac 100644 --- a/NzbDrone.Core/Providers/Indexer/Newznab.cs +++ b/NzbDrone.Core/Providers/Indexer/Newznab.cs @@ -81,13 +81,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode { var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}", RegexOptions.IgnoreCase).Value; currentResult.Size = Parser.GetReportSize(sizeString); - - var dateString = Regex.Match(item.Summary.Text, - @"(?:\)(?.+?)(?:\<\/pubDate\>)", - RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value; - - currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days; } + return currentResult; } diff --git a/NzbDrone.Core/Providers/Indexer/NzbMatrix.cs b/NzbDrone.Core/Providers/Indexer/NzbMatrix.cs index fd1813336..12edbf8df 100644 --- a/NzbDrone.Core/Providers/Indexer/NzbMatrix.cs +++ b/NzbDrone.Core/Providers/Indexer/NzbMatrix.cs @@ -107,13 +107,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode { var sizeString = Regex.Match(item.Summary.Text, @"Size: \d+\.\d{1,2} \w{2}
", RegexOptions.IgnoreCase).Value; currentResult.Size = Parser.GetReportSize(sizeString); - - var dateString = Regex.Match(item.Summary.Text, - @"(?:\Added\:\<\/b\>)(?.+?)(?:\)", - RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value; - - currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days; } + return currentResult; } diff --git a/NzbDrone.Core/Providers/Indexer/NzbsOrg.cs b/NzbDrone.Core/Providers/Indexer/NzbsOrg.cs index 34a988cbe..3363f2e21 100644 --- a/NzbDrone.Core/Providers/Indexer/NzbsOrg.cs +++ b/NzbDrone.Core/Providers/Indexer/NzbsOrg.cs @@ -104,13 +104,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode { var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}", RegexOptions.IgnoreCase).Value; currentResult.Size = Parser.GetReportSize(sizeString); - - var dateString = Regex.Match(item.Summary.Text, - @"(?:\Posted\:\<\/b\>\s)(?.+?)(?:\s[a-zA-Z]+)(?:\)", - RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value; - - currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days; } + return currentResult; } } diff --git a/NzbDrone.Core/Providers/Indexer/NzbsRUs.cs b/NzbDrone.Core/Providers/Indexer/NzbsRUs.cs index ce43bc434..d88c51abf 100644 --- a/NzbDrone.Core/Providers/Indexer/NzbsRUs.cs +++ b/NzbDrone.Core/Providers/Indexer/NzbsRUs.cs @@ -76,13 +76,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode { var sizeString = Regex.Match(item.Summary.Text, @"\d+\.\d{1,2} \w{3}", RegexOptions.IgnoreCase).Value; currentResult.Size = Parser.GetReportSize(sizeString); - - var dateString = Regex.Match(item.Summary.Text, - @"(?:\)(?.+?)(?:\<\/pubDate\>)", - RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value; - - currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days; } + return currentResult; } }