mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fix: NzbMatrix report age is now parsed properly.
This commit is contained in:
parent
4d918ff683
commit
6375df058e
@ -440,6 +440,24 @@ public void newznab_link_should_be_link_to_nzb_not_details()
|
||||
parseResults.Should().NotContain(s => s.NzbUrl.Contains("details"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void nzbmatrix_should_use_age_from_custom()
|
||||
{
|
||||
WithConfiguredIndexers();
|
||||
|
||||
var expectedAge = DateTime.Now.Subtract(new DateTime(2011, 4, 25, 15, 6, 58)).Days;
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbmatrix.xml"));
|
||||
|
||||
//Act
|
||||
var parseResults = Mocker.Resolve<NzbMatrix>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
parseResults[0].Age.Should().Be(expectedAge);
|
||||
}
|
||||
|
||||
private static void Mark500Inconclusive()
|
||||
{
|
||||
ExceptionVerification.MarkInconclusive(typeof(WebException));
|
||||
|
@ -107,6 +107,9 @@ 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 ageString = Regex.Match(item.Summary.Text, @"(?<=\<b\>Added\:\<\/b\>\s)(?<date>.+?)(?=\<br \/\>)", RegexOptions.Compiled | RegexOptions.IgnoreCase).Value;
|
||||
currentResult.Age = DateTime.Now.Subtract(DateTime.Parse(ageString)).Days;
|
||||
}
|
||||
|
||||
return currentResult;
|
||||
|
Loading…
Reference in New Issue
Block a user