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

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
[TestFixture] [TestFixture]
public class AllowedDownloadSpecificationFixture : CoreTest<DownloadDecisionMaker> public class AllowedDownloadSpecificationFixture : CoreTest<DownloadDecisionMaker>
{ {
private List<EpisodeParseResult> _parseResults; private List<IndexerParseResult> _parseResults;
private Mock<IDecisionEngineSpecification> _pass1; private Mock<IDecisionEngineSpecification> _pass1;
private Mock<IDecisionEngineSpecification> _pass2; private Mock<IDecisionEngineSpecification> _pass2;
@ -33,15 +33,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_fail2 = new Mock<IDecisionEngineSpecification>(); _fail2 = new Mock<IDecisionEngineSpecification>();
_fail3 = new Mock<IDecisionEngineSpecification>(); _fail3 = new Mock<IDecisionEngineSpecification>();
_pass1.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<EpisodeParseResult>())).Returns(true); _pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(true);
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).Returns(true); _pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(true);
_fail1.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<EpisodeParseResult>())).Returns(false); _fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<IndexerParseResult>())).Returns(false);
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<EpisodeParseResult>())).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> public class AllowedReleaseGroupSpecificationFixture : CoreTest<AllowedReleaseGroupSpecification>
{ {
private EpisodeParseResult parseResult; private IndexerParseResult parseResult;
[SetUp] [SetUp]
public void Setup() public void Setup()
{ {
parseResult = new EpisodeParseResult parseResult = new IndexerParseResult
{ {
SeriesTitle = "Title", SeriesTitle = "Title",
Language = LanguageType.English, Language = LanguageType.English,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_single_season_episode() public void tostring_single_season_episode()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 }; parseResult.EpisodeNumbers = new List<int> { 3 };
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_single_season_episode_proper() public void tostring_single_season_episode_proper()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3 }; parseResult.EpisodeNumbers = new List<int> { 3 };
@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_multi_season_episode() public void tostring_multi_season_episode()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_multi_season_episode_proper() public void tostring_multi_season_episode_proper()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 }; parseResult.EpisodeNumbers = new List<int> { 3, 4, 5 };
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_full_season() public void tostring_full_season()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.FullSeason = true; parseResult.FullSeason = true;
@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_full_season_proper() public void tostring_full_season_proper()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.FullSeason = true; parseResult.FullSeason = true;
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_daily_show() public void tostring_daily_show()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.FullSeason = true; parseResult.FullSeason = true;
@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test
[Test] [Test]
public void tostring_daily_show_proper() public void tostring_daily_show_proper()
{ {
var parseResult = new EpisodeParseResult(); var parseResult = new IndexerParseResult();
parseResult.SeriesTitle = "My Series"; parseResult.SeriesTitle = "My Series";
parseResult.SeasonNumber = 12; parseResult.SeasonNumber = 12;
parseResult.FullSeason = true; parseResult.FullSeason = true;
@ -162,7 +162,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = title) .With(e => e.Title = title)
.Build()); .Build());
var parsResult = new EpisodeParseResult() var parsResult = new IndexerParseResult()
{ {
AirDate = DateTime.Now, AirDate = DateTime.Now,
EpisodeNumbers = episodes.ToList(), EpisodeNumbers = episodes.ToList(),
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Test
.With(c => c.Title = "My Series Name") .With(c => c.Title = "My Series Name")
.Build(); .Build();
var parsResult = new EpisodeParseResult() var parsResult = new IndexerParseResult()
{ {
AirDate = DateTime.Now, AirDate = DateTime.Now,
Quality = new QualityModel(Quality.Bluray720p, proper), Quality = new QualityModel(Quality.Bluray720p, proper),
@ -210,7 +210,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = "My Episode Title") .With(e => e.Title = "My Episode Title")
.Build(); .Build();
var parsResult = new EpisodeParseResult var parsResult = new IndexerParseResult
{ {
AirDate = new DateTime(2011, 12, 1), AirDate = new DateTime(2011, 12, 1),
Quality = new QualityModel(Quality.Bluray720p, proper), Quality = new QualityModel(Quality.Bluray720p, proper),
@ -238,7 +238,7 @@ namespace NzbDrone.Core.Test
.With(e => e.Title = "My Episode Title (2)") .With(e => e.Title = "My Episode Title (2)")
.Build(); .Build();
var parsResult = new EpisodeParseResult var parsResult = new IndexerParseResult
{ {
AirDate = DateTime.Now, AirDate = DateTime.Now,
EpisodeNumbers = new List<int> { 10, 11 }, 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)] [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) 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.Should().NotBeNull();
result.EpisodeNumbers.Should().HaveCount(1); result.EpisodeNumbers.Should().HaveCount(1);
result.SeasonNumber.Should().Be(seasonNumber); result.SeasonNumber.Should().Be(seasonNumber);
@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.ParserTests
{ {
const string TITLE = "SOMETHING"; 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()); MockedRestProvider.Verify(c => c.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(r => r.Title == TITLE)), Times.Once());
@ -144,7 +144,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "", 7, new[] { 22, 23 })] [TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV-720p].mkv", "", 7, new[] { 22, 23 })]
[TestCase("2x04x05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })] [TestCase("2x04x05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })]
[TestCase("S02E04E05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })] [TestCase("S02E04E05.720p.BluRay-FUTV", "", 2, new[] { 4, 5 })]
[TestCase("S02E03-04-05.720p.BluRay-FUTV", "", 2, new[] { 3,4,5 })] [TestCase("S02E03-04-05.720p.BluRay-FUTV", "", 2, new[] { 3, 4, 5 })]
[TestCase("Breakout.Kings.S02E09-E10.HDTV.x264-ASAP", "Breakout Kings", 2, new[] { 9, 10 })] [TestCase("Breakout.Kings.S02E09-E10.HDTV.x264-ASAP", "Breakout Kings", 2, new[] { 9, 10 })]
[TestCase("Breakout Kings - 2x9-2x10 - Served Cold [SDTV] ", "Breakout Kings", 2, new[] { 9, 10 })] [TestCase("Breakout Kings - 2x9-2x10 - Served Cold [SDTV] ", "Breakout Kings", 2, new[] { 9, 10 })]
[TestCase("Breakout Kings - 2x09-2x10 - Served Cold [SDTV] ", "Breakout Kings", 2, new[] { 9, 10 })] [TestCase("Breakout Kings - 2x09-2x10 - Served Cold [SDTV] ", "Breakout Kings", 2, new[] { 9, 10 })]
@ -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 })] [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) 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.SeasonNumber.Should().Be(season);
result.EpisodeNumbers.Should().BeEquivalentTo(episodes); result.EpisodeNumbers.Should().BeEquivalentTo(episodes);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title)); result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
@ -167,12 +167,12 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)] [TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
[TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)] [TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
[TestCase("The Tonight Show with Jay Leno - 2011-06-16 - Larry David, \"Bachelorette\" Ashley Hebert, Pitbull with Ne-Yo", "The Tonight Show with Jay Leno", 2011, 6, 16)] [TestCase("The Tonight Show with Jay Leno - 2011-06-16 - Larry David, \"Bachelorette\" Ashley Hebert, Pitbull with Ne-Yo", "The Tonight Show with Jay Leno", 2011, 6, 16)]
[TestCase("2020.NZ.2012.16.02.PDTV.XviD-C4TV","2020nz", 2012,2, 16)] [TestCase("2020.NZ.2012.16.02.PDTV.XviD-C4TV", "2020nz", 2012, 2, 16)]
[TestCase("2020.NZ.2012.13.02.PDTV.XviD-C4TV","2020nz", 2012,2, 13)] [TestCase("2020.NZ.2012.13.02.PDTV.XviD-C4TV", "2020nz", 2012, 2, 13)]
[TestCase("2020.NZ.2011.12.02.PDTV.XviD-C4TV","2020nz", 2011,12, 2)] [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) 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); var airDate = new DateTime(year, month, day);
result.Should().NotBeNull(); result.Should().NotBeNull();
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title)); 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)); 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)] [TestCase("Adventure Time S02 720p HDTV x264 CRON", "Adventure Time", 2)]
public void full_season_release_parse(string postTitle, string title, int season) 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.SeasonNumber.Should().Be(season);
result.CleanTitle.Should().Be(Parser.NormalizeTitle(title)); result.CleanTitle.Should().Be(Parser.NormalizeTitle(title));
result.EpisodeNumbers.Count.Should().Be(0); 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)] [TestCase("Doctor Who Confidential Season 3", "Doctor Who Confidential", 3)]
public void parse_season_info(string postTitle, string seriesName, int seasonNumber) 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.CleanTitle.Should().Be(Parser.NormalizeTitle(seriesName));
result.SeasonNumber.Should().Be(seasonNumber); result.SeasonNumber.Should().Be(seasonNumber);
@ -364,7 +364,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Instant Star S03 EXTRAS DVDRip XviD OSiTV")] [TestCase("Instant Star S03 EXTRAS DVDRip XviD OSiTV")]
public void parse_season_extras(string postTitle) public void parse_season_extras(string postTitle)
{ {
var result = Parser.ParseTitle(postTitle); var result = Parser.ParseTitle<ParseResult>(postTitle);
result.Should().BeNull(); result.Should().BeNull();
} }
@ -374,7 +374,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("CSI.S11.SUBPACK.DVDRip.XviD-REWARD")] [TestCase("CSI.S11.SUBPACK.DVDRip.XviD-REWARD")]
public void parse_season_subpack(string postTitle) public void parse_season_subpack(string postTitle)
{ {
var result = Parser.ParseTitle(postTitle); var result = Parser.ParseTitle<ParseResult>(postTitle);
result.Should().BeNull(); 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")] [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) public void unparsable_should_log_error_but_not_throw(string title)
{ {
Parser.ParseTitle(title); Parser.ParseTitle<ParseResult>(title);
ExceptionVerification.IgnoreWarns(); ExceptionVerification.IgnoreWarns();
ExceptionVerification.ExpectedErrors(1); 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("[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("[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")] [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")] [TestCase("password - \"bdc435cb-93c4-4902-97ea-ca00568c3887.337\" yEnc")]
public void should_not_parse_encypted_posts(string title) public void should_not_parse_encypted_posts(string title)
{ {
Parser.ParseTitle(title).Should().BeNull(); Parser.ParseTitle<ParseResult>(title).Should().BeNull();
ExceptionVerification.IgnoreWarns(); ExceptionVerification.IgnoreWarns();
} }
} }

View File

@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile(); With80MBFile();
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -195,7 +195,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() Mocker.GetMock<IEpisodeService>()
.Setup(c => c.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())) .Setup(c => c.GetEpisodesByParseResult(It.IsAny<IndexerParseResult>()))
.Returns(new List<Episode>()); .Returns(new List<Episode>());
@ -226,7 +226,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -258,7 +258,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -291,7 +291,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -329,7 +329,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -358,7 +358,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(false); .Returns(false);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
@ -380,7 +380,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile(); 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>()); .Returns(new List<Episode>());
Mocker.GetMock<DiskProvider>().Setup(s => s.IsChildOfPath(path, series.Path)) 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.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] [Test]
@ -403,7 +403,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
With80MBFile(); 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>()); .Returns(new List<Episode>());
Mocker.GetMock<DiskProvider>().Setup(s => s.IsChildOfPath(path, series.Path)) 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.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] [Test]
@ -455,7 +455,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(600); .Returns(600);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);
@ -482,7 +482,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(60); .Returns(60);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);
@ -513,7 +513,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
.Returns(60); .Returns(60);
Mocker.GetMock<IEpisodeService>() 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); var result = Mocker.Resolve<DiskScanProvider>().ImportFile(_series, path);

View File

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

View File

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

View File

@ -4,6 +4,6 @@ namespace NzbDrone.Core.DecisionEngine
{ {
public interface IDecisionEngineSpecification : IRejectWithReason 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"; } 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); _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); _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) 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); _logger.Trace("Checking if report meets language requirements. {0}", subject.Language);
if (subject.Language != LanguageType.English) 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); 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); 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); _logger.Trace("Checking if report meets quality requirements. {0}", subject.Quality);
if (!subject.Series.QualityProfile.Allowed.Contains(subject.Quality.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); _logger.Trace("Checking if report meets retention requirements. {0}", subject.Age);
if (_configService.Retention > 0 && subject.Age > _configService.Retention) 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"; return "Episode doesn't match";
} }
} }
public bool IsSatisfiedBy(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase) public bool IsSatisfiedBy(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase)
{ {
var dailySearchSpec = searchDefinitionBase as DailyEpisodeSearchDefinition; var dailySearchSpec = searchDefinitionBase as DailyEpisodeSearchDefinition;
@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
var episode = _episodeService.GetEpisode(dailySearchSpec.SeriesId, dailySearchSpec.Airtime); 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."); _logger.Trace("Episode AirDate does not match searched episode number, skipping.");
return false; return false;

View File

@ -6,6 +6,6 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search
{ {
public interface IDecisionEngineSearchSpecification : IRejectWithReason 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; var singleEpisodeSpec = searchDefinitionBase as SeasonSearchDefinition;
if (singleEpisodeSpec == null) return true; 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."); _logger.Trace("Season number does not match searched season number, skipping.");
return false; 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; var singleEpisodeSpec = searchDefinitionBase as SingleEpisodeSearchDefinition;
if (singleEpisodeSpec == null) return true; 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."); _logger.Trace("Season number does not match searched season number, skipping.");
return false; 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."); _logger.Trace("Episode number does not match searched episode number, skipping.");
return false; 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)) 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) 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); 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 try
{ {

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
set set
{ {
_title = value; _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 FileSizeMb { get; set; }
public Int32 RemainingSizeMb { 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 try
{ {
//Todo: Allow full season releases //Todo: Allow full season releases
if (Parser.ParseTitle(title).FullSeason) if (Parser.ParseTitle<ParseResult>(title).FullSeason)
{ {
logger.Info("Skipping Full Season Release: {0}", title); logger.Info("Skipping Full Season Release: {0}", title);
return false; 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; 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 try
{ {

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters; using NzbDrone.Core.Download.Clients.Sabnzbd.JsonConverters;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
namespace NzbDrone.Core.Download.Clients.Sabnzbd namespace NzbDrone.Core.Download.Clients.Sabnzbd
@ -27,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
set set
{ {
_title = value; _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")] [JsonProperty(PropertyName = "nzo_id")]
public string Id { get; set; } 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 public interface IDownloadService
{ {
bool DownloadReport(EpisodeParseResult parseResult); bool DownloadReport(IndexerParseResult parseResult);
} }
public class DownloadService : IDownloadService public class DownloadService : IDownloadService
@ -32,7 +32,7 @@ namespace NzbDrone.Core.Download
_logger = logger; _logger = logger;
} }
public bool DownloadReport(EpisodeParseResult parseResult) public bool DownloadReport(IndexerParseResult parseResult)
{ {
var downloadTitle = parseResult.OriginalString; var downloadTitle = parseResult.OriginalString;
if (!_configService.DownloadClientUseSceneName) if (!_configService.DownloadClientUseSceneName)
@ -54,7 +54,7 @@ namespace NzbDrone.Core.Download
return success; 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)); 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 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; ParseResult = parseResult;
} }

View File

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

View File

@ -100,7 +100,7 @@ namespace NzbDrone.Core.ExternalNotification
try try
{ {
_logger.Trace("Sending download notification to {0}", Name); _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) catch (Exception e)
{ {

View File

@ -105,10 +105,10 @@ namespace NzbDrone.Core.IndexerSearch
return spec; 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 indexers = _indexerService.GetAvailableIndexers();
var parseResults = new List<EpisodeParseResult>(); var parseResults = new List<IndexerParseResult>();
Parallel.ForEach(indexers, indexer => Parallel.ForEach(indexers, indexer =>
{ {

View File

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

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@ namespace NzbDrone.Core.Indexers.NzbIndex
return item.Links[0].Uri.ToString(); 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) if (currentResult != null)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Core.MediaFiles.Events
{ {
public class EpisodeDownloadedEvent : IEvent 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; ParseResult = parseResult;
} }

View File

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

View File

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

View File

@ -1,4 +1,4 @@
 using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
@ -6,9 +6,9 @@ using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using NLog; using NLog;
using NzbDrone.Common; using NzbDrone.Common;
using NzbDrone.Core.Qualities; using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
using NzbDrone.Core.Model; using NzbDrone.Core.Model;
namespace NzbDrone.Core namespace NzbDrone.Core
{ {
@ -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); 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 fileInfo = new FileInfo(path);
var result = ParseTitle(fileInfo.Name); var result = ParseTitle<FileNameParseResult>(fileInfo.Name);
if (result == null) if (result == null)
{ {
Logger.Trace("Attempting to parse episode info using full path. {0}", fileInfo.FullName); 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) if (result != null)
@ -115,7 +115,7 @@ namespace NzbDrone.Core
return result; return result;
} }
internal static EpisodeParseResult ParseTitle(string title) internal static T ParseTitle<T>(string title) where T : ParseResult, new()
{ {
try try
{ {
@ -128,7 +128,7 @@ namespace NzbDrone.Core
if (match.Count != 0) if (match.Count != 0)
{ {
var result = ParseMatchCollection(match); var result = ParseMatchCollection<T>(match);
if (result != null) if (result != null)
{ {
//Check if episode is in the future (most likley a parse error) //Check if episode is in the future (most likley a parse error)
@ -138,7 +138,6 @@ namespace NzbDrone.Core
result.Language = ParseLanguage(title); result.Language = ParseLanguage(title);
result.Quality = ParseQuality(title); result.Quality = ParseQuality(title);
result.OriginalString = title; result.OriginalString = title;
result.ReleaseGroup = ParseReleaseGroup(title);
return result; return result;
} }
} }
@ -155,14 +154,14 @@ namespace NzbDrone.Core
return null; 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('.', ' '); var seriesName = matchCollection[0].Groups["title"].Value.Replace('.', ' ');
int airyear; int airyear;
Int32.TryParse(matchCollection[0].Groups["airyear"].Value, out airyear); Int32.TryParse(matchCollection[0].Groups["airyear"].Value, out airyear);
EpisodeParseResult parsedEpisode; T parsedIndexer;
if (airyear < 1900) if (airyear < 1900)
{ {
@ -183,7 +182,7 @@ namespace NzbDrone.Core
if (seasons.Distinct().Count() > 1) if (seasons.Distinct().Count() > 1)
return null; return null;
parsedEpisode = new EpisodeParseResult parsedIndexer = new T
{ {
SeasonNumber = seasons.First(), SeasonNumber = seasons.First(),
EpisodeNumbers = new List<int>() EpisodeNumbers = new List<int>()
@ -198,7 +197,7 @@ namespace NzbDrone.Core
{ {
var first = Convert.ToInt32(episodeCaptures.First().Value); var first = Convert.ToInt32(episodeCaptures.First().Value);
var last = Convert.ToInt32(episodeCaptures.Last().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 else
{ {
@ -207,7 +206,7 @@ namespace NzbDrone.Core
if (!String.IsNullOrWhiteSpace(matchCollection[0].Groups["extras"].Value)) if (!String.IsNullOrWhiteSpace(matchCollection[0].Groups["extras"].Value))
return null; return null;
parsedEpisode.FullSeason = true; parsedIndexer.FullSeason = true;
} }
} }
} }
@ -226,26 +225,26 @@ namespace NzbDrone.Core
airmonth = tempDay; airmonth = tempDay;
} }
parsedEpisode = new EpisodeParseResult parsedIndexer = new T
{ {
AirDate = new DateTime(airyear, airmonth, airday).Date, 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) public static string ParseSeriesName(string title)
{ {
Logger.Trace("Parsing string '{0}'", title); Logger.Trace("Parsing string '{0}'", title);
var parseResult = ParseTitle(title); var parseResult = ParseTitle<ParseResult>(title);
if(parseResult == null) if (parseResult == null)
return NormalizeTitle(title); return NormalizeTitle(title);
return parseResult.CleanTitle; return parseResult.CleanTitle;
@ -309,7 +308,7 @@ namespace NzbDrone.Core
return result; return result;
} }
if(name.Contains("[WEBDL]")) if (name.Contains("[WEBDL]"))
{ {
result.Quality = Quality.WEBDL720p; result.Quality = Quality.WEBDL720p;
return result; return result;
@ -327,7 +326,7 @@ namespace NzbDrone.Core
if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p")) if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p"))
{ {
if(normalizedName.Contains("1080p")) if (normalizedName.Contains("1080p"))
{ {
result.Quality = Quality.HDTV1080p; result.Quality = Quality.HDTV1080p;
return result; return result;
@ -472,27 +471,7 @@ namespace NzbDrone.Core
return LanguageType.English; 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) public static string NormalizeTitle(string title)
{ {
@ -527,7 +506,7 @@ namespace NzbDrone.Core
internal static string ParseHeader(string header) internal static string ParseHeader(string header)
{ {
foreach(var regex in HeaderRegex) foreach (var regex in HeaderRegex)
{ {
var match = regex.Matches(header); var match = regex.Matches(header);

View File

@ -155,7 +155,6 @@ namespace NzbDrone.Core.Providers
episodeFile.Quality = parseResult.Quality; episodeFile.Quality = parseResult.Quality;
episodeFile.SeasonNumber = parseResult.SeasonNumber; episodeFile.SeasonNumber = parseResult.SeasonNumber;
episodeFile.SceneName = Path.GetFileNameWithoutExtension(filePath.NormalizePath()); 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: 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) //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); Episode GetEpisode(int seriesId, DateTime date);
List<Episode> GetEpisodeBySeries(int seriesId); List<Episode> GetEpisodeBySeries(int seriesId);
List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber); List<Episode> GetEpisodesBySeason(int seriesId, int seasonNumber);
List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult); List<Episode> GetEpisodesByParseResult(ParseResult parseResult);
List<Episode> EpisodesWithoutFiles(bool includeSpecials); List<Episode> EpisodesWithoutFiles(bool includeSpecials);
List<Episode> GetEpisodesByFileId(int episodeFileId); List<Episode> GetEpisodesByFileId(int episodeFileId);
List<Episode> EpisodesWithFiles(); List<Episode> EpisodesWithFiles();
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Tv
return _episodeRepository.GetEpisodes(seriesId, seasonNumber); return _episodeRepository.GetEpisodes(seriesId, seasonNumber);
} }
public List<Episode> GetEpisodesByParseResult(EpisodeParseResult parseResult) public List<Episode> GetEpisodesByParseResult(ParseResult parseResult)
{ {
var result = new List<Episode>(); var result = new List<Episode>();
@ -120,7 +120,10 @@ namespace NzbDrone.Core.Tv
Episode episodeInfo = null; Episode episodeInfo = null;
if (parseResult.SceneSource && parseResult.Series.UseSceneNumbering) 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) if (episodeInfo == null)
{ {