mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +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().NotBeEmpty();
|
||||||
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
|
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
|
||||||
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
|
||||||
|
parseResults.Should().OnlyContain(s => s.Age >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WithConfiguredIndexers()
|
private void WithConfiguredIndexers()
|
||||||
|
@ -218,6 +218,7 @@ private List<EpisodeParseResult> Fetch(IEnumerable<string> urls)
|
|||||||
public EpisodeParseResult ParseFeed(SyndicationItem item)
|
public EpisodeParseResult ParseFeed(SyndicationItem item)
|
||||||
{
|
{
|
||||||
var episodeParseResult = Parser.ParseTitle(item.Title.Text);
|
var episodeParseResult = Parser.ParseTitle(item.Title.Text);
|
||||||
|
if (episodeParseResult != null) episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days;
|
||||||
|
|
||||||
return CustomParser(item, episodeParseResult);
|
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;
|
var sizeString = Regex.Match(item.Summary.Text, @"\(Size: \d*\,?\d+\.\d{1,2}\w{2}\)", RegexOptions.IgnoreCase).Value;
|
||||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
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;
|
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;
|
var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}</a>", RegexOptions.IgnoreCase).Value;
|
||||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
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;
|
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;
|
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);
|
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;
|
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;
|
var sizeString = Regex.Match(item.Summary.Text, @">\d+\.\d{1,2} \w{2}</a>", RegexOptions.IgnoreCase).Value;
|
||||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
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;
|
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;
|
var sizeString = Regex.Match(item.Summary.Text, @"\d+\.\d{1,2} \w{3}", RegexOptions.IgnoreCase).Value;
|
||||||
currentResult.Size = Parser.GetReportSize(sizeString);
|
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;
|
return currentResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user