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

Fix: NzbMatrix report age is now parsed properly.

This commit is contained in:
Mark McDowall 2012-02-28 23:53:30 -08:00
parent 4d918ff683
commit 6375df058e
2 changed files with 21 additions and 0 deletions

View File

@ -440,6 +440,24 @@ public void newznab_link_should_be_link_to_nzb_not_details()
parseResults.Should().NotContain(s => s.NzbUrl.Contains("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() private static void Mark500Inconclusive()
{ {
ExceptionVerification.MarkInconclusive(typeof(WebException)); ExceptionVerification.MarkInconclusive(typeof(WebException));

View File

@ -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; 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 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; return currentResult;