Fix: NzbMatrix report age is now parsed properly.

pull/4/head
Mark McDowall 13 years ago
parent 4d918ff683
commit 6375df058e

@ -440,6 +440,24 @@ namespace NzbDrone.Core.Test
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 @@ namespace NzbDrone.Core.Providers.Indexer
{
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…
Cancel
Save