mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-12 11:15:43 +02:00
New: Added support for limited retention. Reports older than the configured retention are skipped.
This commit is contained in:
parent
0dcbe11a41
commit
9d126e54c9
@ -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()
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user