1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

New: Added support for limited retention. Reports older than the configured retention are skipped.

This commit is contained in:
kay.one 2012-02-18 13:18:00 -08:00
parent 0dcbe11a41
commit 9d126e54c9
7 changed files with 7 additions and 30 deletions

View File

@ -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()

View File

@ -218,6 +218,7 @@ private List<EpisodeParseResult> Fetch(IEnumerable<string> 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);
}

View File

@ -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,
@"(?:\<li\>PostDate\:\s)(?<date>.+?(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;
}

View File

@ -81,13 +81,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode
{
var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}</a>", RegexOptions.IgnoreCase).Value;
currentResult.Size = Parser.GetReportSize(sizeString);
var dateString = Regex.Match(item.Summary.Text,
@"(?:\<pubDate\>)(?<date>.+?)(?:\<\/pubDate\>)",
RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value;
currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days;
}
return currentResult;
}

View File

@ -107,13 +107,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode
{
var sizeString = Regex.Match(item.Summary.Text, @"<b>Size:</b> \d+\.\d{1,2} \w{2}<br />", RegexOptions.IgnoreCase).Value;
currentResult.Size = Parser.GetReportSize(sizeString);
var dateString = Regex.Match(item.Summary.Text,
@"(?:\<b\>Added\:\<\/b\>)(?<date>.+?)(?:\<br\s\/\>)",
RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value;
currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days;
}
return currentResult;
}

View File

@ -104,13 +104,8 @@ protected override EpisodeParseResult CustomParser(SyndicationItem item, Episode
{
var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}</a>", RegexOptions.IgnoreCase).Value;
currentResult.Size = Parser.GetReportSize(sizeString);
var dateString = Regex.Match(item.Summary.Text,
@"(?:\<b\>Posted\:\<\/b\>\s)(?<date>.+?)(?:\s[a-zA-Z]+)(?:\<br\s\/\>)",
RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value;
currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days;
}
return currentResult;
}
}

View File

@ -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\>)(?<date>.+?)(?:\<\/pubDate\>)",
RegexOptions.IgnoreCase | RegexOptions.Compiled).Groups["date"].Value;
currentResult.Age = DateTime.Today.Subtract(DateTime.Parse(dateString)).Days;
}
return currentResult;
}
}