broke episodeparseresult into filenameparseresult and indexerparseresult

This commit is contained in:
kay.one 2013-04-07 12:01:24 -07:00
parent 89f261eddf
commit 7c1e81a70e
61 changed files with 248 additions and 251 deletions

View File

@ -21,8 +21,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public class AcceptableSizeSpecificationFixture : CoreTest
{
private EpisodeParseResult parseResultMulti;
private EpisodeParseResult parseResultSingle;
private IndexerParseResult parseResultMulti;
private IndexerParseResult parseResultSingle;
private Series series30minutes;
private Series series60minutes;
private QualitySize qualityType;
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[SetUp]
public void Setup()
{
parseResultMulti = new EpisodeParseResult
parseResultMulti = new IndexerParseResult
{
SeriesTitle = "Title",
Language = LanguageType.English,
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
AirDate = DateTime.Now.AddDays(-12).Date
};
parseResultSingle = new EpisodeParseResult
parseResultSingle = new IndexerParseResult
{
SeriesTitle = "Title",
Language = LanguageType.English,
@ -392,7 +392,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[Test]
public void should_return_true_if_RAWHD()
{
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
Quality = new QualityModel(Quality.RAWHD, false)
};

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[TestFixture]
public class AllowedDownloadSpecificationFixture : CoreTest<DownloadDecisionMaker>
{
private List<EpisodeParseResult> _parseResults;
private List<IndexerParseResult> _parseResults;
private Mock<IDecisionEngineSpecification> _pass1;
private Mock<IDecisionEngineSpecification> _pass2;
@ -33,15 +33,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_fail2 = new Mock<IDecisionEngineSpecification>();
_fail3 = new Mock<IDecisionEngineSpecification>();
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(true);
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(true);
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(true);
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(true);
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(true);
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(true);
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(false);
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(false);
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(false);
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(false);
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(false);
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(false);
_parseResults = new List<EpisodeParseResult>() { new EpisodeParseResult() };
_parseResults = new List<IndexerParseResult>() { new IndexerParseResult() };
}

View File

@ -14,12 +14,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public class AllowedReleaseGroupSpecificationFixture : CoreTest<AllowedReleaseGroupSpecification>
{
private EpisodeParseResult parseResult;
private IndexerParseResult parseResult;
[SetUp]
public void Setup()
{
parseResult = new EpisodeParseResult
parseResult = new IndexerParseResult
{
SeriesTitle = "Title",
Language = LanguageType.English,

View File

@ -23,8 +23,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private CustomStartDateSpecification _customStartDateSpecification;
private EpisodeParseResult parseResultMulti;
private EpisodeParseResult parseResultSingle;
private IndexerParseResult parseResultMulti;
private IndexerParseResult parseResultSingle;
private Series fakeSeries;
private Episode firstEpisode;
private Episode secondEpisode;
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(c => c.CustomStartDate = null)
.Build();
parseResultMulti = new EpisodeParseResult
parseResultMulti = new IndexerParseResult
{
SeriesTitle = "Title",
Series = fakeSeries,
@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Episodes = new List<Episode> { firstEpisode, secondEpisode }
};
parseResultSingle = new EpisodeParseResult
parseResultSingle = new IndexerParseResult
{
SeriesTitle = "Title",
Series = fakeSeries,

View File

@ -20,11 +20,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public class LanguageSpecificationFixture : CoreTest
{
private EpisodeParseResult parseResult;
private IndexerParseResult parseResult;
private void WithEnglishRelease()
{
parseResult = Builder<EpisodeParseResult>
parseResult = Builder<IndexerParseResult>
.CreateNew()
.With(p => p.Language = LanguageType.English)
.Build();
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
private void WithGermanRelease()
{
parseResult = Builder<EpisodeParseResult>
parseResult = Builder<IndexerParseResult>
.CreateNew()
.With(p => p.Language = LanguageType.German)
.Build();

View File

@ -23,8 +23,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private MonitoredEpisodeSpecification monitoredEpisodeSpecification;
private EpisodeParseResult parseResultMulti;
private EpisodeParseResult parseResultSingle;
private IndexerParseResult parseResultMulti;
private IndexerParseResult parseResultSingle;
private Series fakeSeries;
private Episode firstEpisode;
private Episode secondEpisode;
@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(c => c.Monitored = true)
.Build();
parseResultMulti = new EpisodeParseResult
parseResultMulti = new IndexerParseResult
{
SeriesTitle = "Title",
Series = fakeSeries,
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
SeasonNumber = 12,
};
parseResultSingle = new EpisodeParseResult
parseResultSingle = new IndexerParseResult
{
SeriesTitle = "Title",
Series = fakeSeries,

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
public class QualityAllowedByProfileSpecificationFixture : CoreTest
{
private QualityAllowedByProfileSpecification _qualityAllowedByProfile;
private EpisodeParseResult parseResult;
private IndexerParseResult parseResult;
public static object[] AllowedTestCases =
{
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
.Build();
parseResult = new EpisodeParseResult
parseResult = new IndexerParseResult
{
Series = fakeSeries,
Quality = new QualityModel(Quality.DVD, true),

View File

@ -23,14 +23,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private RetentionSpecification retentionSpecification;
private EpisodeParseResult parseResult;
private IndexerParseResult parseResult;
[SetUp]
public void Setup()
{
retentionSpecification = Mocker.Resolve<RetentionSpecification>();
parseResult = new EpisodeParseResult
parseResult = new IndexerParseResult
{
Age = 100
};

View File

@ -24,8 +24,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private UpgradeDiskSpecification _upgradeDisk;
private EpisodeParseResult parseResultMulti;
private EpisodeParseResult parseResultSingle;
private IndexerParseResult parseResultMulti;
private IndexerParseResult parseResultSingle;
private EpisodeFile firstFile;
private EpisodeFile secondFile;
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
.Build();
parseResultMulti = new EpisodeParseResult
parseResultMulti = new IndexerParseResult
{
Series = fakeSeries,
Quality = new QualityModel(Quality.DVD, true),
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Episodes = doubleEpisodeList
};
parseResultSingle = new EpisodeParseResult
parseResultSingle = new IndexerParseResult
{
Series = fakeSeries,
Quality = new QualityModel(Quality.DVD, true),

View File

@ -22,8 +22,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
{
private UpgradeHistorySpecification _upgradeHistory;
private EpisodeParseResult _parseResultMulti;
private EpisodeParseResult _parseResultSingle;
private IndexerParseResult _parseResultMulti;
private IndexerParseResult _parseResultSingle;
private QualityModel _upgradableQuality;
private QualityModel _notupgradableQuality;
private Series _fakeSeries;
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.Bluray1080p })
.Build();
_parseResultMulti = new EpisodeParseResult
_parseResultMulti = new IndexerParseResult
{
Series = _fakeSeries,
Quality = new QualityModel(Quality.DVD, true),
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Episodes = doubleEpisodeList
};
_parseResultSingle = new EpisodeParseResult
_parseResultSingle = new IndexerParseResult
{
Series = _fakeSeries,
Quality = new QualityModel(Quality.DVD, true),

View File

@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int> { 5 },
@ -136,7 +136,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
AirDate = new DateTime(2011, 12, 01),
@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
Quality = new QualityModel { Quality = Quality.Bluray720p, Proper = false },
FullSeason = true,
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
@ -213,7 +213,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
@ -240,7 +240,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
@ -267,7 +267,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithFullQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int>(episodes),
@ -286,7 +286,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabProviderTests
{
WithEmptyQueue();
var parseResult = new EpisodeParseResult
var parseResult = new IndexerParseResult
{
EpisodeTitle = "Title",
EpisodeNumbers = new List<int> { 1 },

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.Download
[TestFixture]
public class DownloadServiceFixture : CoreTest<DownloadService>
{
private EpisodeParseResult _parseResult;
private IndexerParseResult _parseResult;
[SetUp]
public void Setup()
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.Download
.All().With(s => s.SeriesId = 5)
.Build().ToList();
_parseResult = Builder<EpisodeParseResult>.CreateNew()
_parseResult = Builder<IndexerParseResult>.CreateNew()
.With(c => c.Quality = new QualityModel(Quality.DVD, false))
.With(c => c.Series = Builder<Series>.CreateNew().Build())
.With(c => c.EpisodeNumbers = new List<int> { 2 })

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_single_season_episode()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 };
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_single_season_episode_proper()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 };
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_multi_season_episode()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_multi_season_episode_proper()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_full_season()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_full_season_proper()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_daily_show()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test
[Test]
public void tostring_daily_show_proper()
{
var parseResult = new EpisodeParseResult();
var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12;
parseResult.FullSeason = true;
@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = title)
.Build());
var parsResult = new EpisodeParseResult()
var parsResult = new IndexerParseResult()
{
AirDate = DateTime.Now,
EpisodeNumbers = episodes.ToList(),
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Test
.With(c => c.Title = "My Series Name")
.Build();
var parsResult = new EpisodeParseResult()
var parsResult = new IndexerParseResult()
{
AirDate = DateTime.Now,
Quality = new QualityModel(Quality.Bluray720p, proper),
@ -210,7 +210,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = "My Episode Title")
.Build();
var parsResult = new EpisodeParseResult
var parsResult = new IndexerParseResult
{
AirDate = new DateTime(2011, 12, 1),
Quality = new QualityModel(Quality.Bluray720p, proper),
@ -238,7 +238,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = "My Episode Title (2)")
.Build();
var parsResult = new EpisodeParseResult
var parsResult = new IndexerParseResult
{
AirDate = DateTime.Now,
EpisodeNumbers = new List<int> { 10, 11 },

View File

@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Portlandia.S03E10.Alexandra.720p.WEB-DL.AAC2.0.H.264-CROM.mkv", "Portlandia", 3, 10)]
public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<IndexerParseResult>(postTitle);
result.Should().NotBeNull();
result.EpisodeNumbers.Should().HaveCount(1);
result.SeasonNumber.Should().Be(seasonNumber);
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.ParserTests
{
const string TITLE = "SOMETHING";
Parser.ParseTitle(TITLE).Should().BeNull();
Parser.ParseTitle<ParseResult>(TITLE).Should().BeNull();
MockedRestProvider.Verify(c => c.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(r => r.Title == TITLE)), Times.Once());
@ -152,7 +152,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Hell.on.Wheels.S02E09-E10.720p.HDTV.x264-EVOLVE", "Hell on Wheels", 2, new[] { 9, 10 })]
public void TitleParse_multi(string postTitle, string title, int season, int[] episodes)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
result.SeasonNumber.Should().Be(season);
result.EpisodeNumbers.Should().BeEquivalentTo(episodes);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
@ -172,7 +172,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "2020nz", 2011, 12, 2)]
public void parse_daily_episodes(string postTitle, string title, int year, int month, int day)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
var airDate = new DateTime(year, month, day);
result.Should().NotBeNull();
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
@ -186,7 +186,7 @@ namespace NzbDrone.Core.Test.ParserTests
{
var title = string.Format("{0:yyyy.MM.dd} - Denis Leary - HD TV.mkv", DateTime.Now.AddDays(2));
Parser.ParseTitle(title).Should().BeNull();
Parser.ParseTitle<ParseResult>(title).Should().BeNull();
}
@ -197,7 +197,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Adventure Time S02 720p HDTV x264 CRON", "Adventure Time", 2)]
public void full_season_release_parse(string postTitle, string title, int season)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
result.SeasonNumber.Should().Be(season);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(0);
@ -338,7 +338,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Doctor Who Confidential Season 3", "Doctor Who Confidential", 3)]
public void parse_season_info(string postTitle, string seriesName, int seasonNumber)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(seriesName));
result.SeasonNumber.Should().Be(seasonNumber);
@ -364,7 +364,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Instant Star S03 EXTRAS DVDRip XviD OSiTV")]
public void parse_season_extras(string postTitle)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
result.Should().BeNull();
}
@ -374,7 +374,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("CSI.S11.SUBPACK.DVDRip.XviD-REWARD")]
public void parse_season_subpack(string postTitle)
{
var result = Parser.ParseTitle(postTitle);
var result = Parser.ParseTitle<ParseResult>(postTitle);
result.Should().BeNull();
}
@ -382,22 +382,11 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Fussball Bundesliga 10e2011e30 Spieltag FC Bayern Muenchen vs Bayer 04 Leverkusen German WS dTV XviD WoGS")]
public void unparsable_should_log_error_but_not_throw(string title)
{
Parser.ParseTitle(title);
Parser.ParseTitle<ParseResult>(title);
ExceptionVerification.IgnoreWarns();
ExceptionVerification.ExpectedErrors(1);
}
[TestCase("Castle.2009.S01E14.English.HDTV.XviD-LOL", "LOL")]
[TestCase("Castle 2009 S01E14 English HDTV XviD LOL", "LOL")]
[TestCase("Acropolis Now S05 EXTRAS DVDRip XviD RUNNER", "RUNNER")]
[TestCase("Punky.Brewster.S01.EXTRAS.DVDRip.XviD-RUNNER", "RUNNER")]
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV", "C4TV")]
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "OSiTV")]
public void parse_releaseGroup(string title, string expected)
{
Parser.ParseReleaseGroup(title).Should().Be(expected);
}
[TestCase("[112461]-[FULL]-[#a.b.teevee@EFNet]-[ 666.Park.Avenue.S01E03.720p.HDTV.X264-DIMENSION ]-[02/31] - \"the.devils.address.103.720p-dimension.par2\" yEnc", "666.Park.Avenue.S01E03.720p.HDTV.X264-DIMENSION")]
[TestCase("[112438]-[FULL]-[#a.b.teevee@EFNet]-[ Downton_Abbey.3x05.HDTV_x264-FoV ]-[01/26] - \"downton_abbey.3x05.hdtv_x264-fov.nfo\" yEnc", "Downton_Abbey.3x05.HDTV_x264-FoV")]
[TestCase("[ 21154 ] - [ TrollHD ] - [ 00/73 ] - \"MythBusters S03E20 Escape Slide Parachute 1080i HDTV-UPSCALE DD5.1 MPEG2-TrollHD.nzb\" yEnc", "MythBusters S03E20 Escape Slide Parachute 1080i HDTV-UPSCALE DD5.1 MPEG2-TrollHD.nzb")]
@ -409,7 +398,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("password - \"bdc435cb-93c4-4902-97ea-ca00568c3887.337\" yEnc")]
public void should_not_parse_encypted_posts(string title)
{
Parser.ParseTitle(title).Should().BeNull();
Parser.ParseTitle<ParseResult>(title).Should().BeNull();
ExceptionVerification.IgnoreWarns();
}
}

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -195,7 +195,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>()))
.Returns(new List<Episode>());
@ -226,7 +226,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -258,7 +258,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(fakeEpisodes);
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -291,7 +291,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(fakeEpisodes);
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -329,7 +329,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -358,7 +358,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -380,7 +380,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>()))
.Returns(new List<Episode>());
Mocker.GetMock<DiskProvider>().Setup(s => s.IsChildOfPath(path, series.Path))
@ -388,7 +388,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.Resolve<DiskScanProvider>().ImportFile(series, path);
Mocker.Verify<IEpisodeService>(s => s.GetEpisodesByParseResult(It.Is<EpisodeParseResult>(p => p.SceneSource)), Times.Once());
Mocker.Verify<IEpisodeService>(s => s.GetEpisodesByParseResult(It.Is<IndexerParseResult>(p => p.SceneSource)), Times.Once());
}
[Test]
@ -403,7 +403,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile();
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>()))
Mocker.GetMock<IEpisodeService>().Setup(s => s.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>()))
.Returns(new List<Episode>());
Mocker.GetMock<DiskProvider>().Setup(s => s.IsChildOfPath(path, series.Path))
@ -411,7 +411,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
Mocker.Resolve<DiskScanProvider>().ImportFile(series, path);
Mocker.Verify<IEpisodeService>(s => s.GetEpisodesByParseResult(It.Is<EpisodeParseResult>(p => p.SceneSource == false)), Times.Once());
Mocker.Verify<IEpisodeService>(s => s.GetEpisodesByParseResult(It.Is<IndexerParseResult>(p => p.SceneSource == false)), Times.Once());
}
[Test]
@ -455,7 +455,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(600);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);
@ -482,7 +482,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(60);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);
@ -513,7 +513,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(60);
Mocker.GetMock<IEpisodeService>()
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>())).Returns(new List<Episode> { fakeEpisode });
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Core.DecisionEngine
{
public class DownloadDecision
{
public EpisodeParseResult ParseResult { get; private set; }
public IndexerParseResult ParseResult { get; private set; }
public IEnumerable<string> Rejections { get; private set; }
public bool Approved
@ -17,14 +17,14 @@ namespace NzbDrone.Core.DecisionEngine
}
}
public DownloadDecision(EpisodeParseResult parseResult, params string[] rejections)
public DownloadDecision(IndexerParseResult parseResult, params string[] rejections)
{
ParseResult = parseResult;
Rejections = rejections.ToList();
}
public static EpisodeParseResult PickBestReport(IEnumerable<DownloadDecision> downloadDecisions)
public static IndexerParseResult PickBestReport(IEnumerable<DownloadDecision> downloadDecisions)
{
var reports = downloadDecisions
.Where(c => c.Approved)

View File

@ -8,8 +8,8 @@ namespace NzbDrone.Core.DecisionEngine
{
public interface IMakeDownloadDecision
{
IEnumerable<DownloadDecision> GetRssDecision(IEnumerable<EpisodeParseResult> episodeParseResults);
IEnumerable<DownloadDecision> GetSearchDecision(IEnumerable<EpisodeParseResult> episodeParseResult, SearchDefinitionBase searchDefinitionBase);
IEnumerable<DownloadDecision> GetRssDecision(IEnumerable<IndexerParseResult> episodeParseResults);
IEnumerable<DownloadDecision> GetSearchDecision(IEnumerable<IndexerParseResult> episodeParseResult, SearchDefinitionBase searchDefinitionBase);
}
public class DownloadDecisionMaker : IMakeDownloadDecision
@ -21,7 +21,7 @@ namespace NzbDrone.Core.DecisionEngine
_specifications = specifications;
}
public IEnumerable<DownloadDecision> GetRssDecision(IEnumerable<EpisodeParseResult> episodeParseResults)
public IEnumerable<DownloadDecision> GetRssDecision(IEnumerable<IndexerParseResult> episodeParseResults)
{
foreach (var parseResult in episodeParseResults)
{
@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine
}
public IEnumerable<DownloadDecision> GetSearchDecision(IEnumerable<EpisodeParseResult> episodeParseResults, SearchDefinitionBase searchDefinitionBase)
public IEnumerable<DownloadDecision> GetSearchDecision(IEnumerable<IndexerParseResult> episodeParseResults, SearchDefinitionBase searchDefinitionBase)
{
foreach (var parseResult in episodeParseResults)
{
@ -45,19 +45,19 @@ namespace NzbDrone.Core.DecisionEngine
}
private IEnumerable<string> GetGeneralRejectionReasons(EpisodeParseResult episodeParseResult)
private IEnumerable<string> GetGeneralRejectionReasons(IndexerParseResult indexerParseResult)
{
return _specifications
.OfType<IDecisionEngineSpecification>()
.Where(spec => !spec.IsSatisfiedBy(episodeParseResult))
.Where(spec => !spec.IsSatisfiedBy(indexerParseResult))
.Select(spec => spec.RejectionReason);
}
private IEnumerable<string> GetSearchRejectionReasons(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase)
private IEnumerable<string> GetSearchRejectionReasons(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
{
return _specifications
.OfType<IDecisionEngineSearchSpecification>()
.Where(spec => !spec.IsSatisfiedBy(episodeParseResult, searchDefinitionBase))
.Where(spec => !spec.IsSatisfiedBy(indexerParseResult, searchDefinitionBase))
.Select(spec => spec.RejectionReason);
}
}

View File

@ -4,6 +4,6 @@ namespace NzbDrone.Core.DecisionEngine
{
public interface IDecisionEngineSpecification : IRejectWithReason
{
bool IsSatisfiedBy(EpisodeParseResult subject);
bool IsSatisfiedBy(IndexerParseResult subject);
}
}

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
get { return "File size too big or small"; }
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
_logger.Trace("Beginning size check for: {0}", subject);

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
_logger.Trace("Beginning release group check for: {0}", subject);

View File

@ -22,7 +22,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
if (!subject.Series.CustomStartDate.HasValue)
{

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
_logger.Trace("Checking if report meets language requirements. {0}", subject.Language);
if (subject.Language != LanguageType.English)

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
var series = _seriesRepository.GetByTitle(subject.CleanTitle);

View File

@ -21,7 +21,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
return !_downloadClientProvider.GetDownloadClient().IsInQueue(subject);
}

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
_logger.Trace("Checking if report meets quality requirements. {0}", subject.Quality);
if (!subject.Series.QualityProfile.Allowed.Contains(subject.Quality.Quality))

View File

@ -24,7 +24,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
_logger.Trace("Checking if report meets retention requirements. {0}", subject.Age);
if (_configService.Retention > 0 && subject.Age > _configService.Retention)

View File

@ -23,7 +23,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
return "Episode doesn't match";
}
}
public bool IsSatisfiedBy(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase)
public bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
{
var dailySearchSpec = searchDefinitionBase as DailyEpisodeSearchDefinition;
@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
var episode = _episodeService.GetEpisode(dailySearchSpec.SeriesId, dailySearchSpec.Airtime);
if (!episodeParseResult.AirDate.HasValue || episodeParseResult.AirDate.Value != episode.AirDate.Value)
if (!indexerParseResult.AirDate.HasValue || indexerParseResult.AirDate.Value != episode.AirDate.Value)
{
_logger.Trace("Episode AirDate does not match searched episode number, skipping.");
return false;

View File

@ -6,6 +6,6 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
{
public interface IDecisionEngineSearchSpecification : IRejectWithReason
{
bool IsSatisfiedBy(EpisodeParseResult subject, SearchDefinitionBase searchDefinitionBase);
bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase);
}
}

View File

@ -21,12 +21,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
}
}
public bool IsSatisfiedBy(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase)
public bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
{
var singleEpisodeSpec = searchDefinitionBase as SeasonSearchDefinition;
if (singleEpisodeSpec == null) return true;
if (singleEpisodeSpec.SeasonNumber != episodeParseResult.SeasonNumber)
if (singleEpisodeSpec.SeasonNumber != indexerParseResult.SeasonNumber)
{
_logger.Trace("Season number does not match searched season number, skipping.");
return false;

View File

@ -21,18 +21,18 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
}
}
public bool IsSatisfiedBy(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase)
public bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
{
var singleEpisodeSpec = searchDefinitionBase as SingleEpisodeSearchDefinition;
if (singleEpisodeSpec == null) return true;
if (singleEpisodeSpec.SeasonNumber != episodeParseResult.SeasonNumber)
if (singleEpisodeSpec.SeasonNumber != indexerParseResult.SeasonNumber)
{
_logger.Trace("Season number does not match searched season number, skipping.");
return false;
}
if (!episodeParseResult.EpisodeNumbers.Contains(singleEpisodeSpec.EpisodeNumber))
if (!indexerParseResult.EpisodeNumbers.Contains(singleEpisodeSpec.EpisodeNumber))
{
_logger.Trace("Episode number does not match searched episode number, skipping.");
return false;

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
foreach (var file in subject.Episodes.Select(c => c.EpisodeFile).Where(c => c != null))
{

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
}
}
public virtual bool IsSatisfiedBy(EpisodeParseResult subject)
public virtual bool IsSatisfiedBy(IndexerParseResult subject)
{
foreach (var episode in subject.Episodes)
{

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Download.Clients
}
}
public virtual bool IsInQueue(EpisodeParseResult newParseResult)
public virtual bool IsInQueue(IndexerParseResult newParseResult)
{
return !_upgradeHistorySpecification.IsSatisfiedBy(newParseResult);
}

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
{
}
public virtual bool IsInQueue(EpisodeParseResult newParseResult)
public virtual bool IsInQueue(IndexerParseResult newParseResult)
{
try
{

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
set
{
_title = value;
ParseResult = Parser.ParseTitle(value.Replace("DUPLICATE / ", String.Empty));
ParseResult = Parser.ParseTitle<ParseResult>(value.Replace("DUPLICATE / ", String.Empty));
}
}
@ -26,6 +26,6 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
public Int32 FileSizeMb { get; set; }
public Int32 RemainingSizeMb { get; set; }
public EpisodeParseResult ParseResult { private set; get; }
public ParseResult ParseResult { private set; get; }
}
}

View File

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Download.Clients
try
{
//Todo: Allow full season releases
if (Parser.ParseTitle(title).FullSeason)
if (Parser.ParseTitle<ParseResult>(title).FullSeason)
{
logger.Info("Skipping Full Season Release: {0}", title);
return false;
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Download.Clients
}
}
public virtual bool IsInQueue(EpisodeParseResult newParseResult)
public virtual bool IsInQueue(IndexerParseResult newParseResult)
{
return false;
}

View File

@ -31,7 +31,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
{
}
public virtual bool IsInQueue(EpisodeParseResult newParseResult)
public virtual bool IsInQueue(IndexerParseResult newParseResult)
{
try
{

View File

@ -1,8 +1,6 @@
using System;
using System.Linq;
using Newtonsoft.Json;
using NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model;
namespace NzbDrone.Core.Download.Clients.Sabnzbd
@ -27,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
set
{
_title = value;
ParseResult = Parser.ParseTitle(value.Replace("DUPLICATE / ", String.Empty));
ParseResult = Parser.ParseTitle<ParseResult>(value.Replace("DUPLICATE / ", String.Empty));
}
}
@ -45,6 +43,6 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
[JsonProperty(PropertyName = "nzo_id")]
public string Id { get; set; }
public EpisodeParseResult ParseResult { private set; get; }
public ParseResult ParseResult { private set; get; }
}
}

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Download
{
public interface IDownloadService
{
bool DownloadReport(EpisodeParseResult parseResult);
bool DownloadReport(IndexerParseResult parseResult);
}
public class DownloadService : IDownloadService
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Download
_logger = logger;
}
public bool DownloadReport(EpisodeParseResult parseResult)
public bool DownloadReport(IndexerParseResult parseResult)
{
var downloadTitle = parseResult.OriginalString;
if (!_configService.DownloadClientUseSceneName)
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Download
return success;
}
private static bool ContainsRecentEpisode(EpisodeParseResult parseResult)
private static bool ContainsRecentEpisode(IndexerParseResult parseResult)
{
return parseResult.Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-7));
}

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Core.Download
{
public class EpisodeGrabbedEvent : IEvent
{
public EpisodeParseResult ParseResult { get; private set; }
public IndexerParseResult ParseResult { get; private set; }
public EpisodeGrabbedEvent(EpisodeParseResult parseResult)
public EpisodeGrabbedEvent(IndexerParseResult parseResult)
{
ParseResult = parseResult;
}

View File

@ -5,7 +5,7 @@ namespace NzbDrone.Core.Download
{
public interface IDownloadClient
{
bool IsInQueue(EpisodeParseResult newParseResult);
bool IsInQueue(IndexerParseResult newParseResult);
bool DownloadNzb(string url, string title, bool recentlyAired);
}
}

View File

@ -100,7 +100,7 @@ namespace NzbDrone.Core.ExternalNotification
try
{
_logger.Trace("Sending download notification to {0}", Name);
OnDownload(message.ParseResult.GetDownloadTitle(), message.ParseResult.Series);
OnDownload(message.ParseResult.ToString(), message.ParseResult.Series);
}
catch (Exception e)
{

View File

@ -105,10 +105,10 @@ namespace NzbDrone.Core.IndexerSearch
return spec;
}
private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<EpisodeParseResult>> searchAction, SearchDefinitionBase definitionBase)
private List<DownloadDecision> Dispatch(Func<IIndexerBase, IEnumerable<IndexerParseResult>> searchAction, SearchDefinitionBase definitionBase)
{
var indexers = _indexerService.GetAvailableIndexers();
var parseResults = new List<EpisodeParseResult>();
var parseResults = new List<IndexerParseResult>();
Parallel.ForEach(indexers, indexer =>
{

View File

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Indexers
{
public interface IParseFeed
{
IEnumerable<EpisodeParseResult> Process(Stream source);
IEnumerable<IndexerParseResult> Process(Stream source);
}
public class BasicRssParser : IParseFeed
@ -21,12 +21,12 @@ namespace NzbDrone.Core.Indexers
_logger = LogManager.GetCurrentClassLogger();
}
public IEnumerable<EpisodeParseResult> Process(Stream source)
public IEnumerable<IndexerParseResult> Process(Stream source)
{
var reader = new SyndicationFeedXmlReader(source);
var feed = SyndicationFeed.Load(reader).Items;
var result = new List<EpisodeParseResult>();
var result = new List<IndexerParseResult>();
foreach (var syndicationItem in feed)
{
@ -66,26 +66,46 @@ namespace NzbDrone.Core.Indexers
return string.Empty;
}
protected virtual EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected virtual IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
return currentResult;
}
private EpisodeParseResult ParseFeed(SyndicationItem item)
private IndexerParseResult ParseFeed(SyndicationItem item)
{
var title = GetTitle(item);
var episodeParseResult = Parser.ParseTitle(title);
var episodeParseResult = Parser.ParseTitle<IndexerParseResult>(title);
if (episodeParseResult != null)
{
episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days;
episodeParseResult.OriginalString = title;
episodeParseResult.SceneSource = true;
episodeParseResult.ReleaseGroup = ParseReleaseGroup(title);
}
_logger.Trace("Parsed: {0} from: {1}", episodeParseResult, item.Title.Text);
return PostProcessor(item, episodeParseResult);
}
private static string ParseReleaseGroup(string title)
{
title = title.Trim();
var index = title.LastIndexOf('-');
if (index < 0)
index = title.LastIndexOf(' ');
if (index < 0)
return String.Empty;
var group = title.Substring(index + 1);
if (group.Length == title.Length)
return String.Empty;
return group;
}
}
}

View File

@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.FileSharingTalk
return item.Id;
}
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -10,12 +10,12 @@ namespace NzbDrone.Core.Indexers
{
public interface IFetchFeedFromIndexers
{
IList<EpisodeParseResult> FetchRss(IIndexerBase indexer);
IList<IndexerParseResult> FetchRss(IIndexerBase indexer);
IList<EpisodeParseResult> Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition);
IList<EpisodeParseResult> Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition);
IList<EpisodeParseResult> Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition);
IList<EpisodeParseResult> Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition);
IList<IndexerParseResult> Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition);
IList<IndexerParseResult> Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition);
IList<IndexerParseResult> Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition);
IList<IndexerParseResult> Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition);
}
public class FetchFeedService : IFetchFeedFromIndexers
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Indexers
}
public virtual IList<EpisodeParseResult> FetchRss(IIndexerBase indexer)
public virtual IList<IndexerParseResult> FetchRss(IIndexerBase indexer)
{
_logger.Debug("Fetching feeds from " + indexer.Name);
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers
return result;
}
public IList<EpisodeParseResult> Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition)
public IList<IndexerParseResult> Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition)
{
_logger.Debug("Searching for {0}", searchDefinition);
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Indexers
return result;
}
public IList<EpisodeParseResult> Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition)
public IList<IndexerParseResult> Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition)
{
_logger.Debug("Searching for {0}", searchDefinition);
@ -67,7 +67,7 @@ namespace NzbDrone.Core.Indexers
}
public IList<EpisodeParseResult> Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition)
public IList<IndexerParseResult> Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition)
{
_logger.Debug("Searching for {0}", searchDefinition);
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Indexers
return result;
}
public IList<EpisodeParseResult> Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition)
public IList<IndexerParseResult> Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition)
{
_logger.Debug("Searching for {0}", searchDefinition);
@ -90,9 +90,9 @@ namespace NzbDrone.Core.Indexers
return result;
}
private List<EpisodeParseResult> Fetch(IIndexerBase indexer, IEnumerable<string> urls)
private List<IndexerParseResult> Fetch(IIndexerBase indexer, IEnumerable<string> urls)
{
var result = new List<EpisodeParseResult>();
var result = new List<IndexerParseResult>();
foreach (var url in urls)
{

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Indexers.Newznab
return item.Id;
}
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Core.Indexers.NzbClub
{
public class NzbClubParser : BasicRssParser
{
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Indexers.NzbIndex
return item.Links[0].Uri.ToString();
}
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Core.Indexers.NzbsRUs
{
public class NzbsrusParser : BasicRssParser
{
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -19,9 +19,9 @@ namespace NzbDrone.Core.Indexers.Nzbx
_serializer = new JsonSerializer();
}
public IEnumerable<EpisodeParseResult> Process(Stream source)
public IEnumerable<IndexerParseResult> Process(Stream source)
{
var result = new List<EpisodeParseResult>();
var result = new List<IndexerParseResult>();
var jsonReader = new JsonTextReader(new StreamReader(source));
var feed = _serializer.Deserialize<List<NzbxRecentItem>>(jsonReader);
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Indexers.Nzbx
{
try
{
var episodeParseResult = Parser.ParseTitle(item.Name);
var episodeParseResult = Parser.ParseTitle<IndexerParseResult>(item.Name);
if (episodeParseResult != null)
{
episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PostDate).Days;

View File

@ -26,7 +26,7 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
return String.Empty;
}
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -65,7 +65,7 @@ namespace NzbDrone.Core.Indexers
public interface IFetchAndParseRss
{
List<EpisodeParseResult> Fetch();
List<IndexerParseResult> Fetch();
}
public class FetchAndParseRssService : IFetchAndParseRss
@ -79,9 +79,9 @@ namespace NzbDrone.Core.Indexers
_feedFetcher = feedFetcher;
}
public List<EpisodeParseResult> Fetch()
public List<IndexerParseResult> Fetch()
{
var result = new List<EpisodeParseResult>();
var result = new List<IndexerParseResult>();
var indexers = _indexerService.GetAvailableIndexers();

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.Indexers.Wombles
return null;
}
protected override EpisodeParseResult PostProcessor(SyndicationItem item, EpisodeParseResult currentResult)
protected override IndexerParseResult PostProcessor(SyndicationItem item, IndexerParseResult currentResult)
{
if (currentResult != null)
{

View File

@ -4,7 +4,6 @@ using System.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Download;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.Tv;

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Core.MediaFiles.Events
{
public class EpisodeDownloadedEvent : IEvent
{
public EpisodeParseResult ParseResult { get; private set; }
public FileNameParseResult ParseResult { get; private set; }
public EpisodeDownloadedEvent(EpisodeParseResult parseResult)
public EpisodeDownloadedEvent(FileNameParseResult parseResult)
{
ParseResult = parseResult;
}

View File

@ -7,7 +7,7 @@ using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Model
{
public class EpisodeParseResult
public class ParseResult
{
public string SeriesTitle { get; set; }
@ -19,7 +19,6 @@ namespace NzbDrone.Core.Model
}
}
public DownloadDecision Decision { get; set; }
public string EpisodeTitle { get; set; }
@ -33,24 +32,14 @@ namespace NzbDrone.Core.Model
public LanguageType Language { get; set; }
public string NzbUrl { get; set; }
public string NzbInfoUrl { get; set; }
public string OriginalString { get; set; }
public Series Series { get; set; }
public String Indexer { get; set; }
public bool FullSeason { get; set; }
public long Size { get; set; }
public int Age { get; set; }
public string ReleaseGroup { get; set; }
public bool SceneSource { get; set; }
public IList<Episode> Episodes { get; set; }
@ -74,8 +63,23 @@ namespace NzbDrone.Core.Model
return string.Format("{0} - {1} {2}", SeriesTitle, episodeString, Quality);
}
}
public class IndexerParseResult : ParseResult
{
public DownloadDecision Decision { get; set; }
public string NzbUrl { get; set; }
public string NzbInfoUrl { get; set; }
public String Indexer { get; set; }
public int Age { get; set; }
public string ReleaseGroup { get; set; }
public string GetDownloadTitle()
{
var seriesTitle = FileNameBuilder.CleanFilename(Series.Title);
@ -134,4 +138,10 @@ namespace NzbDrone.Core.Model
return result;
}
}
public class FileNameParseResult :ParseResult
{
}
}

View File

@ -509,7 +509,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ExternalNotification\ExternalNotificationDefinition.cs" />
<Compile Include="Model\EpisodeParseResult.cs" />
<Compile Include="Model\IndexerParseResult.cs" />
<Compile Include="Model\EpisodeStatusType.cs" />
<Compile Include="Download\Clients\Sabnzbd\SabPriorityType.cs" />
<Compile Include="Model\SeasonParseResult.cs" />

View File

@ -91,16 +91,16 @@ namespace NzbDrone.Core
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>ita|italian)|(?<german>german\b)|(?<flemish>flemish)|(?<greek>greek)(?:\W|_)", RegexOptions.IgnoreCase | RegexOptions.Compiled);
internal static EpisodeParseResult ParsePath(string path)
internal static FileNameParseResult ParsePath(string path)
{
var fileInfo = new FileInfo(path);
var result = ParseTitle(fileInfo.Name);
var result = ParseTitle<FileNameParseResult>(fileInfo.Name);
if (result == null)
{
Logger.Trace("Attempting to parse episode info using full path. {0}", fileInfo.FullName);
result = ParseTitle(fileInfo.FullName);
result = ParseTitle<FileNameParseResult>(fileInfo.FullName);
}
if (result != null)
@ -115,7 +115,7 @@ namespace NzbDrone.Core
return result;
}
internal static EpisodeParseResult ParseTitle(string title)
internal static T ParseTitle<T>(string title) where T : ParseResult, new()
{
try
{
@ -128,7 +128,7 @@ namespace NzbDrone.Core
if (match.Count != 0)
{
var result = ParseMatchCollection(match);
var result = ParseMatchCollection<T>(match);
if (result != null)
{
//Check if episode is in the future (most likley a parse error)
@ -138,7 +138,6 @@ namespace NzbDrone.Core
result.Language = ParseLanguage(title);
result.Quality = ParseQuality(title);
result.OriginalString = title;
result.ReleaseGroup = ParseReleaseGroup(title);
return result;
}
}
@ -155,14 +154,14 @@ namespace NzbDrone.Core
return null;
}
private static EpisodeParseResult ParseMatchCollection(MatchCollection matchCollection)
private static T ParseMatchCollection<T>(MatchCollection matchCollection) where T : ParseResult, new()
{
var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' ');
int airyear;
Int32.TryParse(matchCollection[0].Groups["airyear"].Value, out airyear);
EpisodeParseResult parsedEpisode;
T parsedIndexer;
if (airyear < 1900)
{
@ -183,7 +182,7 @@ namespace NzbDrone.Core
if (seasons.Distinct().Count() > 1)
return null;
parsedEpisode = new EpisodeParseResult
parsedIndexer = new T
{
SeasonNumber = seasons.First(),
EpisodeNumbers = new List<int>()
@ -198,7 +197,7 @@ namespace NzbDrone.Core
{
var first = Convert.ToInt32(episodeCaptures.First().Value);
var last = Convert.ToInt32(episodeCaptures.Last().Value);
parsedEpisode.EpisodeNumbers = Enumerable.Range(first, last - first + 1).ToList();
parsedIndexer.EpisodeNumbers = Enumerable.Range(first, last - first + 1).ToList();
}
else
{
@ -207,7 +206,7 @@ namespace NzbDrone.Core
if (!String.IsNullOrWhiteSpace(matchCollection[0].Groups["extras"].Value))
return null;
parsedEpisode.FullSeason = true;
parsedIndexer.FullSeason = true;
}
}
}
@ -226,24 +225,24 @@ namespace NzbDrone.Core
airmonth = tempDay;
}
parsedEpisode = new EpisodeParseResult
parsedIndexer = new T
{
AirDate = new DateTime(airyear, airmonth, airday).Date,
};
}
parsedEpisode.SeriesTitle = seriesName;
parsedIndexer.SeriesTitle = seriesName;
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
Logger.Trace("Episode Parsed. {0}", parsedIndexer);
return parsedEpisode;
return parsedIndexer;
}
public static string ParseSeriesName(string title)
{
Logger.Trace("Parsing string '{0}'", title);
var parseResult = ParseTitle(title);
var parseResult = ParseTitle<ParseResult>(title);
if (parseResult == null)
return NormalizeTitle(title);
@ -472,27 +471,7 @@ namespace NzbDrone.Core
return LanguageType.English;
}
internal static string ParseReleaseGroup(string title)
{
Logger.Trace("Trying to parse release group for {0}", title);
title = title.Trim();
var index = title.LastIndexOf('-');
if (index < 0)
index = title.LastIndexOf(' ');
if (index < 0)
return String.Empty;
var group = title.Substring(index + 1);
if (group.Length == title.Length)
return String.Empty;
Logger.Trace("Release Group found: {0}", group);
return group;
}
public static string NormalizeTitle(string title)
{

View File

@ -155,7 +155,6 @@ namespace NzbDrone.Core.Providers
episodeFile.Quality = parseResult.Quality;
episodeFile.SeasonNumber = parseResult.SeasonNumber;
episodeFile.SceneName = Path.GetFileNameWithoutExtension(filePath.NormalizePath());
episodeFile.ReleaseGroup = parseResult.ReleaseGroup;
//Todo: We shouldn't actually import the file until we confirm its the only one we want.
//Todo: Separate episodeFile creation from importing (pass file to import to import)

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.Tv
Episode GetEpisode(int seriesId, DateTime date);
List<Episode> GetEpisodeBySeries(int seriesId);
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult);
List<Episode> GetEpisodesByParseResult(ParseResult parseResult);
List<Episode> EpisodesWithoutFiles(bool includeSpecials);
List<Episode> GetEpisodesByFileId(int episodeFileId);
List<Episode> EpisodesWithFiles();
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Tv
return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
}
public List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult)
public List<Episode> GetEpisodesByParseResult(ParseResult parseResult)
{
var result = new List<Episode>();
@ -120,7 +120,10 @@ namespace NzbDrone.Core.Tv
Episode episodeInfo = null;
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering)
episodeInfo = _episodeRepository.GetEpisodeBySceneNumbering(parseResult.Series.Id, parseResult.SeasonNumber, episodeNumber);
{
episodeInfo = _episodeRepository.GetEpisodeBySceneNumbering(parseResult.Series.Id,
parseResult.SeasonNumber, episodeNumber);
}
if (episodeInfo == null)
{