From 7c1e81a70e317d80e03a960f683fb1a2997b0b66 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 7 Apr 2013 12:01:24 -0700 Subject: [PATCH] broke episodeparseresult into filenameparseresult and indexerparseresult --- .../AcceptableSizeSpecificationFixture.cs | 10 +-- .../AllowedDownloadSpecificationFixture.cs | 16 ++--- ...AllowedReleaseGroupSpecificationFixture.cs | 4 +- .../CustomStartDateSpecificationFixture.cs | 8 +-- .../LanguageSpecificationFixture.cs | 6 +- .../MonitoredEpisodeSpecificationFixture.cs | 8 +-- ...ityAllowedByProfileSpecificationFixture.cs | 4 +- .../RetentionSpecificationFixture.cs | 4 +- .../UpgradeDiskSpecificationFixture.cs | 8 +-- .../UpgradeHistorySpecificationFixture.cs | 8 +-- .../SabProviderTests/QueueFixture.cs | 16 ++--- .../Download/DownloadServiceFixture.cs | 4 +- NzbDrone.Core.Test/EpisodeParseResultTest.cs | 24 +++---- .../ParserTests/ParserFixture.cs | 45 +++++------- .../ImportFileFixture.cs | 32 ++++----- .../DecisionEngine/DownloadDecision.cs | 6 +- .../DecisionEngine/DownloadDecisionMaker.cs | 16 ++--- .../IDecisionEngineSpecification.cs | 2 +- .../AcceptableSizeSpecification.cs | 2 +- .../AllowedReleaseGroupSpecification.cs | 2 +- .../CustomStartDateSpecification.cs | 2 +- .../Specifications/LanguageSpecification.cs | 2 +- .../MonitoredEpisodeSpecification.cs | 2 +- .../Specifications/NotInQueueSpecification.cs | 2 +- .../QualityAllowedByProfileSpecification.cs | 2 +- .../Specifications/RetentionSpecification.cs | 2 +- .../Search/DailyEpisodeMatchSpecification.cs | 4 +- .../IDecisionEngineSearchSpecification.cs | 2 +- .../Search/SeasonMatchSpecification.cs | 4 +- .../Search/SingleEpisodeMatchSpecification.cs | 6 +- .../UpgradeDiskSpecification.cs | 2 +- .../UpgradeHistorySpecification.cs | 2 +- .../Download/Clients/BlackholeProvider.cs | 2 +- .../Download/Clients/Nzbget/NzbgetProvider.cs | 2 +- .../Download/Clients/Nzbget/QueueItem.cs | 4 +- .../Download/Clients/PneumaticProvider.cs | 6 +- .../Download/Clients/Sabnzbd/SabProvider.cs | 2 +- .../Download/Clients/Sabnzbd/SabQueueItem.cs | 6 +- NzbDrone.Core/Download/DownloadService.cs | 6 +- NzbDrone.Core/Download/EpisodeGrabbedEvent.cs | 4 +- NzbDrone.Core/Download/IDownloadClient.cs | 2 +- .../ExternalNotificationBase.cs | 2 +- .../IndexerSearch/NzbSearchService.cs | 4 +- NzbDrone.Core/Indexers/BasicRssParser.cs | 32 +++++++-- .../FileSharingTalk/FileSharingTalkParser.cs | 2 +- NzbDrone.Core/Indexers/IndexerFetchService.cs | 24 +++---- .../Indexers/Newznab/NewznabParser.cs | 2 +- .../Indexers/NzbClub/NzbClubParser.cs | 2 +- .../Indexers/NzbIndex/NzbIndexParser.cs | 2 +- .../Indexers/NzbsRUs/NzbsrusParser.cs | 2 +- NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs | 6 +- .../Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs | 2 +- NzbDrone.Core/Indexers/RssSyncService.cs | 6 +- .../Indexers/Wombles/WomblesParser.cs | 2 +- .../MediaFiles/EpisodeFileMovingService.cs | 1 - .../Events/EpisodeDownloadedEvent.cs | 4 +- ...deParseResult.cs => IndexerParseResult.cs} | 34 +++++---- NzbDrone.Core/NzbDrone.Core.csproj | 2 +- NzbDrone.Core/Parser.cs | 69 +++++++------------ NzbDrone.Core/Providers/DiskScanProvider.cs | 1 - NzbDrone.Core/Tv/EpisodeService.cs | 9 ++- 61 files changed, 248 insertions(+), 251 deletions(-) rename NzbDrone.Core/Model/{EpisodeParseResult.cs => IndexerParseResult.cs} (95%) diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs index df877fbf6..a209b6a0e 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs @@ -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) }; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs index b29c009fa..b3252ef23 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AllowedDownloadSpecificationFixture.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestFixture] public class AllowedDownloadSpecificationFixture : CoreTest { - private List _parseResults; + private List _parseResults; private Mock _pass1; private Mock _pass2; @@ -33,15 +33,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _fail2 = new Mock(); _fail3 = new Mock(); - _pass1.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); - _pass2.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); - _pass3.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); + _pass1.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); + _pass2.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); + _pass3.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(true); - _fail1.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); - _fail2.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); - _fail3.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); + _fail1.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); + _fail2.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); + _fail3.Setup(c => c.IsSatisfiedBy(It.IsAny())).Returns(false); - _parseResults = new List() { new EpisodeParseResult() }; + _parseResults = new List() { new IndexerParseResult() }; } diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs index ee69dfe46..691a7551d 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs @@ -14,12 +14,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class AllowedReleaseGroupSpecificationFixture : CoreTest { - private EpisodeParseResult parseResult; + private IndexerParseResult parseResult; [SetUp] public void Setup() { - parseResult = new EpisodeParseResult + parseResult = new IndexerParseResult { SeriesTitle = "Title", Language = LanguageType.English, diff --git a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs index 4bef7547d..773f66c68 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs @@ -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 { firstEpisode, secondEpisode } }; - parseResultSingle = new EpisodeParseResult + parseResultSingle = new IndexerParseResult { SeriesTitle = "Title", Series = fakeSeries, diff --git a/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs index 14e9b69a8..1cfc4f6f3 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs @@ -20,11 +20,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class LanguageSpecificationFixture : CoreTest { - private EpisodeParseResult parseResult; + private IndexerParseResult parseResult; private void WithEnglishRelease() { - parseResult = Builder + parseResult = Builder .CreateNew() .With(p => p.Language = LanguageType.English) .Build(); @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void WithGermanRelease() { - parseResult = Builder + parseResult = Builder .CreateNew() .With(p => p.Language = LanguageType.German) .Build(); diff --git a/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs index c2ea96b62..1fb502e6c 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs @@ -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, diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs index 3f18e9e44..f89c69999 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs @@ -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), diff --git a/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs index 627f3e43f..e654857a1 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs @@ -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(); - parseResult = new EpisodeParseResult + parseResult = new IndexerParseResult { Age = 100 }; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs index 070b82b6f..7ca40b306 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs @@ -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), diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs index 634f90959..4e0474da7 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs @@ -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), diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs index 6e6d79a41..61a8da6ac 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/SabProviderTests/QueueFixture.cs @@ -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 { 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(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(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(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(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 { 1 }, diff --git a/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs b/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs index 1758c57f3..3460625f7 100644 --- a/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadServiceFixture.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.Download [TestFixture] public class DownloadServiceFixture : CoreTest { - 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.CreateNew() + _parseResult = Builder.CreateNew() .With(c => c.Quality = new QualityModel(Quality.DVD, false)) .With(c => c.Series = Builder.CreateNew().Build()) .With(c => c.EpisodeNumbers = new List { 2 }) diff --git a/NzbDrone.Core.Test/EpisodeParseResultTest.cs b/NzbDrone.Core.Test/EpisodeParseResultTest.cs index 37ea2ffcf..aed60dc85 100644 --- a/NzbDrone.Core.Test/EpisodeParseResultTest.cs +++ b/NzbDrone.Core.Test/EpisodeParseResultTest.cs @@ -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 { 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 { 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 { 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 { 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 { 10, 11 }, diff --git a/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 7e50f172d..4d49733bd 100644 --- a/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -10,7 +10,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ParserTests { - + [TestFixture] public class ParserFixture : CoreTest { @@ -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(postTitle); result.Should().NotBeNull(); result.EpisodeNumbers.Should().HaveCount(1); result.SeasonNumber.Should().Be(seasonNumber); @@ -113,7 +113,7 @@ namespace NzbDrone.Core.Test.ParserTests public void unparsable_path_should_report_the_path() { Parser.ParsePath("C:\\").Should().BeNull(); - + MockedRestProvider.Verify(c => c.PostData(It.IsAny(), It.IsAny()), Times.Exactly(2)); ExceptionVerification.IgnoreWarns(); @@ -124,7 +124,7 @@ namespace NzbDrone.Core.Test.ParserTests { const string TITLE = "SOMETHING"; - Parser.ParseTitle(TITLE).Should().BeNull(); + Parser.ParseTitle(TITLE).Should().BeNull(); MockedRestProvider.Verify(c => c.PostData(It.IsAny(), It.Is(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("2x04x05.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 - 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 })] @@ -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(postTitle); result.SeasonNumber.Should().Be(season); result.EpisodeNumbers.Should().BeEquivalentTo(episodes); 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.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("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.2011.12.02.PDTV.XviD-C4TV","2020nz", 2011,12, 2)] + [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.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(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(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(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(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(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(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(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(title).Should().BeNull(); ExceptionVerification.IgnoreWarns(); } } diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs index 37f29d96f..3dde91b2f 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs @@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(fakeSeries, newFile); @@ -95,7 +95,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests With80MBFile(); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(fakeSeries, newFile); @@ -125,7 +125,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -195,7 +195,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(c => c.GetEpisodesByParseResult(It.IsAny())) + .Setup(c => c.GetEpisodesByParseResult(It.IsAny())) .Returns(new List()); @@ -226,7 +226,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -258,7 +258,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -291,7 +291,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -329,7 +329,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode1, fakeEpisode2 }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode1, fakeEpisode2 }); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -358,7 +358,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(false); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); @@ -380,7 +380,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests With80MBFile(); - Mocker.GetMock().Setup(s => s.GetEpisodesByParseResult(It.IsAny())) + Mocker.GetMock().Setup(s => s.GetEpisodesByParseResult(It.IsAny())) .Returns(new List()); Mocker.GetMock().Setup(s => s.IsChildOfPath(path, series.Path)) @@ -388,7 +388,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.Resolve().ImportFile(series, path); - Mocker.Verify(s => s.GetEpisodesByParseResult(It.Is(p => p.SceneSource)), Times.Once()); + Mocker.Verify(s => s.GetEpisodesByParseResult(It.Is(p => p.SceneSource)), Times.Once()); } [Test] @@ -403,7 +403,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests With80MBFile(); - Mocker.GetMock().Setup(s => s.GetEpisodesByParseResult(It.IsAny())) + Mocker.GetMock().Setup(s => s.GetEpisodesByParseResult(It.IsAny())) .Returns(new List()); Mocker.GetMock().Setup(s => s.IsChildOfPath(path, series.Path)) @@ -411,7 +411,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.Resolve().ImportFile(series, path); - Mocker.Verify(s => s.GetEpisodesByParseResult(It.Is(p => p.SceneSource == false)), Times.Once()); + Mocker.Verify(s => s.GetEpisodesByParseResult(It.Is(p => p.SceneSource == false)), Times.Once()); } [Test] @@ -455,7 +455,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(600); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(_series, path); @@ -482,7 +482,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(60); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(_series, path); @@ -513,7 +513,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(60); Mocker.GetMock() - .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); + .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); var result = Mocker.Resolve().ImportFile(_series, path); diff --git a/NzbDrone.Core/DecisionEngine/DownloadDecision.cs b/NzbDrone.Core/DecisionEngine/DownloadDecision.cs index cbc3a4373..9ec5b9bb0 100644 --- a/NzbDrone.Core/DecisionEngine/DownloadDecision.cs +++ b/NzbDrone.Core/DecisionEngine/DownloadDecision.cs @@ -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 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 downloadDecisions) + public static IndexerParseResult PickBestReport(IEnumerable downloadDecisions) { var reports = downloadDecisions .Where(c => c.Approved) diff --git a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index 450e66e5a..9f1fac6b8 100644 --- a/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -8,8 +8,8 @@ namespace NzbDrone.Core.DecisionEngine { public interface IMakeDownloadDecision { - IEnumerable GetRssDecision(IEnumerable episodeParseResults); - IEnumerable GetSearchDecision(IEnumerable episodeParseResult, SearchDefinitionBase searchDefinitionBase); + IEnumerable GetRssDecision(IEnumerable episodeParseResults); + IEnumerable GetSearchDecision(IEnumerable episodeParseResult, SearchDefinitionBase searchDefinitionBase); } public class DownloadDecisionMaker : IMakeDownloadDecision @@ -21,7 +21,7 @@ namespace NzbDrone.Core.DecisionEngine _specifications = specifications; } - public IEnumerable GetRssDecision(IEnumerable episodeParseResults) + public IEnumerable GetRssDecision(IEnumerable episodeParseResults) { foreach (var parseResult in episodeParseResults) { @@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine } - public IEnumerable GetSearchDecision(IEnumerable episodeParseResults, SearchDefinitionBase searchDefinitionBase) + public IEnumerable GetSearchDecision(IEnumerable episodeParseResults, SearchDefinitionBase searchDefinitionBase) { foreach (var parseResult in episodeParseResults) { @@ -45,19 +45,19 @@ namespace NzbDrone.Core.DecisionEngine } - private IEnumerable GetGeneralRejectionReasons(EpisodeParseResult episodeParseResult) + private IEnumerable GetGeneralRejectionReasons(IndexerParseResult indexerParseResult) { return _specifications .OfType() - .Where(spec => !spec.IsSatisfiedBy(episodeParseResult)) + .Where(spec => !spec.IsSatisfiedBy(indexerParseResult)) .Select(spec => spec.RejectionReason); } - private IEnumerable GetSearchRejectionReasons(EpisodeParseResult episodeParseResult, SearchDefinitionBase searchDefinitionBase) + private IEnumerable GetSearchRejectionReasons(IndexerParseResult indexerParseResult, SearchDefinitionBase searchDefinitionBase) { return _specifications .OfType() - .Where(spec => !spec.IsSatisfiedBy(episodeParseResult, searchDefinitionBase)) + .Where(spec => !spec.IsSatisfiedBy(indexerParseResult, searchDefinitionBase)) .Select(spec => spec.RejectionReason); } } diff --git a/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs b/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs index b51de99ee..33260f1f2 100644 --- a/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/IDecisionEngineSpecification.cs @@ -4,6 +4,6 @@ namespace NzbDrone.Core.DecisionEngine { public interface IDecisionEngineSpecification : IRejectWithReason { - bool IsSatisfiedBy(EpisodeParseResult subject); + bool IsSatisfiedBy(IndexerParseResult subject); } } \ No newline at end of file diff --git a/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs index 916669f01..4b42a1c70 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/AcceptableSizeSpecification.cs @@ -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); diff --git a/NzbDrone.Core/DecisionEngine/Specifications/AllowedReleaseGroupSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/AllowedReleaseGroupSpecification.cs index ac01f135c..80a78b135 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/AllowedReleaseGroupSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/AllowedReleaseGroupSpecification.cs @@ -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); diff --git a/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs index da5a25e62..5a9b43fda 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs @@ -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) { diff --git a/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs index 35c5a2659..74eac7ea8 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/LanguageSpecification.cs @@ -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) diff --git a/NzbDrone.Core/DecisionEngine/Specifications/MonitoredEpisodeSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/MonitoredEpisodeSpecification.cs index b457ac05b..e6997af83 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/MonitoredEpisodeSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/MonitoredEpisodeSpecification.cs @@ -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); diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs index 90344a8fd..c43cdcd3e 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/NotInQueueSpecification.cs @@ -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); } diff --git a/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs index c134f1727..6aaba8a57 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/QualityAllowedByProfileSpecification.cs @@ -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)) diff --git a/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs index a0ca08d9b..968e24ce5 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/RetentionSpecification.cs @@ -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) diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs index a6784a42f..95a45bcff 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/Search/DailyEpisodeMatchSpecification.cs @@ -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; diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/IDecisionEngineSearchSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/Search/IDecisionEngineSearchSpecification.cs index 909a3f21f..f670d3f5a 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/Search/IDecisionEngineSearchSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/Search/IDecisionEngineSearchSpecification.cs @@ -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); } } \ No newline at end of file diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs index e2d9300ec..58f265e25 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/Search/SeasonMatchSpecification.cs @@ -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; diff --git a/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs index 66b5512d3..1aa7be413 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/Search/SingleEpisodeMatchSpecification.cs @@ -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; diff --git a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs index 86d42a600..209c8d7ee 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeDiskSpecification.cs @@ -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)) { diff --git a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeHistorySpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeHistorySpecification.cs index fec243a36..c6e962030 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/UpgradeHistorySpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/UpgradeHistorySpecification.cs @@ -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) { diff --git a/NzbDrone.Core/Download/Clients/BlackholeProvider.cs b/NzbDrone.Core/Download/Clients/BlackholeProvider.cs index 3f358b5de..0a2e1e138 100644 --- a/NzbDrone.Core/Download/Clients/BlackholeProvider.cs +++ b/NzbDrone.Core/Download/Clients/BlackholeProvider.cs @@ -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); } diff --git a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs index 3811827bf..d26315657 100644 --- a/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs +++ b/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProvider.cs @@ -27,7 +27,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { } - public virtual bool IsInQueue(EpisodeParseResult newParseResult) + public virtual bool IsInQueue(IndexerParseResult newParseResult) { try { diff --git a/NzbDrone.Core/Download/Clients/Nzbget/QueueItem.cs b/NzbDrone.Core/Download/Clients/Nzbget/QueueItem.cs index d7d0a896d..173be61a7 100644 --- a/NzbDrone.Core/Download/Clients/Nzbget/QueueItem.cs +++ b/NzbDrone.Core/Download/Clients/Nzbget/QueueItem.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget set { _title = value; - ParseResult = Parser.ParseTitle(value.Replace("DUPLICATE / ", String.Empty)); + ParseResult = Parser.ParseTitle(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; } } } diff --git a/NzbDrone.Core/Download/Clients/PneumaticProvider.cs b/NzbDrone.Core/Download/Clients/PneumaticProvider.cs index 3bc797850..559d2d9d8 100644 --- a/NzbDrone.Core/Download/Clients/PneumaticProvider.cs +++ b/NzbDrone.Core/Download/Clients/PneumaticProvider.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Download.Clients try { //Todo: Allow full season releases - if (Parser.ParseTitle(title).FullSeason) + if (Parser.ParseTitle(title).FullSeason) { logger.Info("Skipping Full Season Release: {0}", title); return false; @@ -58,7 +58,7 @@ namespace NzbDrone.Core.Download.Clients var contents = String.Format("plugin://plugin.program.pneumatic/?mode=strm&type=add_file&nzb={0}&nzbname={1}", filename, title); _diskProvider.WriteAllText(Path.Combine(_configService.DownloadClientTvDirectory, title + ".strm"), contents); - + return true; } catch (Exception ex) @@ -68,7 +68,7 @@ namespace NzbDrone.Core.Download.Clients } } - public virtual bool IsInQueue(EpisodeParseResult newParseResult) + public virtual bool IsInQueue(IndexerParseResult newParseResult) { return false; } diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs index da2ebdf47..2eb9855b5 100644 --- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs +++ b/NzbDrone.Core/Download/Clients/Sabnzbd/SabProvider.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd { } - public virtual bool IsInQueue(EpisodeParseResult newParseResult) + public virtual bool IsInQueue(IndexerParseResult newParseResult) { try { diff --git a/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs b/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs index 35a0b4e94..17ff4c915 100644 --- a/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs +++ b/NzbDrone.Core/Download/Clients/Sabnzbd/SabQueueItem.cs @@ -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(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; } } } diff --git a/NzbDrone.Core/Download/DownloadService.cs b/NzbDrone.Core/Download/DownloadService.cs index dad046613..6ac18c79b 100644 --- a/NzbDrone.Core/Download/DownloadService.cs +++ b/NzbDrone.Core/Download/DownloadService.cs @@ -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)); } diff --git a/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs b/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs index 6ca4339cb..a88c642cd 100644 --- a/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs +++ b/NzbDrone.Core/Download/EpisodeGrabbedEvent.cs @@ -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; } diff --git a/NzbDrone.Core/Download/IDownloadClient.cs b/NzbDrone.Core/Download/IDownloadClient.cs index b7092e950..a2077df11 100644 --- a/NzbDrone.Core/Download/IDownloadClient.cs +++ b/NzbDrone.Core/Download/IDownloadClient.cs @@ -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); } } diff --git a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs index 76a6ef268..9571560b2 100644 --- a/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs +++ b/NzbDrone.Core/ExternalNotification/ExternalNotificationBase.cs @@ -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) { diff --git a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs b/NzbDrone.Core/IndexerSearch/NzbSearchService.cs index 883bc76ae..6b8dc228a 100644 --- a/NzbDrone.Core/IndexerSearch/NzbSearchService.cs +++ b/NzbDrone.Core/IndexerSearch/NzbSearchService.cs @@ -105,10 +105,10 @@ namespace NzbDrone.Core.IndexerSearch return spec; } - private List Dispatch(Func> searchAction, SearchDefinitionBase definitionBase) + private List Dispatch(Func> searchAction, SearchDefinitionBase definitionBase) { var indexers = _indexerService.GetAvailableIndexers(); - var parseResults = new List(); + var parseResults = new List(); Parallel.ForEach(indexers, indexer => { diff --git a/NzbDrone.Core/Indexers/BasicRssParser.cs b/NzbDrone.Core/Indexers/BasicRssParser.cs index 12bf6d2c4..58547addc 100644 --- a/NzbDrone.Core/Indexers/BasicRssParser.cs +++ b/NzbDrone.Core/Indexers/BasicRssParser.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.Indexers { public interface IParseFeed { - IEnumerable Process(Stream source); + IEnumerable Process(Stream source); } public class BasicRssParser : IParseFeed @@ -21,12 +21,12 @@ namespace NzbDrone.Core.Indexers _logger = LogManager.GetCurrentClassLogger(); } - public IEnumerable Process(Stream source) + public IEnumerable Process(Stream source) { var reader = new SyndicationFeedXmlReader(source); var feed = SyndicationFeed.Load(reader).Items; - var result = new List(); + var result = new List(); 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(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; + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Indexers/FileSharingTalk/FileSharingTalkParser.cs b/NzbDrone.Core/Indexers/FileSharingTalk/FileSharingTalkParser.cs index e851cac26..82621c435 100644 --- a/NzbDrone.Core/Indexers/FileSharingTalk/FileSharingTalkParser.cs +++ b/NzbDrone.Core/Indexers/FileSharingTalk/FileSharingTalkParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/IndexerFetchService.cs b/NzbDrone.Core/Indexers/IndexerFetchService.cs index b2ef0f676..64d2960a6 100644 --- a/NzbDrone.Core/Indexers/IndexerFetchService.cs +++ b/NzbDrone.Core/Indexers/IndexerFetchService.cs @@ -10,12 +10,12 @@ namespace NzbDrone.Core.Indexers { public interface IFetchFeedFromIndexers { - IList FetchRss(IIndexerBase indexer); + IList FetchRss(IIndexerBase indexer); - IList Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition); - IList Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition); - IList Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition); - IList Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition); + IList Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition); + IList Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition); + IList Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition); + IList Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition); } public class FetchFeedService : IFetchFeedFromIndexers @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Indexers } - public virtual IList FetchRss(IIndexerBase indexer) + public virtual IList FetchRss(IIndexerBase indexer) { _logger.Debug("Fetching feeds from " + indexer.Name); @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Indexers return result; } - public IList Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition) + public IList Fetch(IIndexerBase indexer, SeasonSearchDefinition searchDefinition) { _logger.Debug("Searching for {0}", searchDefinition); @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Indexers return result; } - public IList Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition) + public IList Fetch(IIndexerBase indexer, SingleEpisodeSearchDefinition searchDefinition) { _logger.Debug("Searching for {0}", searchDefinition); @@ -67,7 +67,7 @@ namespace NzbDrone.Core.Indexers } - public IList Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition) + public IList Fetch(IIndexerBase indexer, PartialSeasonSearchDefinition searchDefinition) { _logger.Debug("Searching for {0}", searchDefinition); @@ -79,7 +79,7 @@ namespace NzbDrone.Core.Indexers return result; } - public IList Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition) + public IList Fetch(IIndexerBase indexer, DailyEpisodeSearchDefinition searchDefinition) { _logger.Debug("Searching for {0}", searchDefinition); @@ -90,9 +90,9 @@ namespace NzbDrone.Core.Indexers return result; } - private List Fetch(IIndexerBase indexer, IEnumerable urls) + private List Fetch(IIndexerBase indexer, IEnumerable urls) { - var result = new List(); + var result = new List(); foreach (var url in urls) { diff --git a/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs b/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs index f9e9f194f..c053c96b5 100644 --- a/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs +++ b/NzbDrone.Core/Indexers/Newznab/NewznabParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/NzbClub/NzbClubParser.cs b/NzbDrone.Core/Indexers/NzbClub/NzbClubParser.cs index 4333dfcda..2ef956064 100644 --- a/NzbDrone.Core/Indexers/NzbClub/NzbClubParser.cs +++ b/NzbDrone.Core/Indexers/NzbClub/NzbClubParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/NzbIndex/NzbIndexParser.cs b/NzbDrone.Core/Indexers/NzbIndex/NzbIndexParser.cs index 890e40de8..3af292b1e 100644 --- a/NzbDrone.Core/Indexers/NzbIndex/NzbIndexParser.cs +++ b/NzbDrone.Core/Indexers/NzbIndex/NzbIndexParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/NzbsRUs/NzbsrusParser.cs b/NzbDrone.Core/Indexers/NzbsRUs/NzbsrusParser.cs index 92342f590..87d935e55 100644 --- a/NzbDrone.Core/Indexers/NzbsRUs/NzbsrusParser.cs +++ b/NzbDrone.Core/Indexers/NzbsRUs/NzbsrusParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs b/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs index 7fe3e620f..2584b967d 100644 --- a/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs +++ b/NzbDrone.Core/Indexers/Nzbx/NzbxParser.cs @@ -19,9 +19,9 @@ namespace NzbDrone.Core.Indexers.Nzbx _serializer = new JsonSerializer(); } - public IEnumerable Process(Stream source) + public IEnumerable Process(Stream source) { - var result = new List(); + var result = new List(); var jsonReader = new JsonTextReader(new StreamReader(source)); var feed = _serializer.Deserialize>(jsonReader); @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Indexers.Nzbx { try { - var episodeParseResult = Parser.ParseTitle(item.Name); + var episodeParseResult = Parser.ParseTitle(item.Name); if (episodeParseResult != null) { episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PostDate).Days; diff --git a/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs b/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs index 099ec37a4..16deb8ca9 100644 --- a/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs +++ b/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs @@ -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) { diff --git a/NzbDrone.Core/Indexers/RssSyncService.cs b/NzbDrone.Core/Indexers/RssSyncService.cs index 492f0bcde..539ee31f3 100644 --- a/NzbDrone.Core/Indexers/RssSyncService.cs +++ b/NzbDrone.Core/Indexers/RssSyncService.cs @@ -65,7 +65,7 @@ namespace NzbDrone.Core.Indexers public interface IFetchAndParseRss { - List Fetch(); + List Fetch(); } public class FetchAndParseRssService : IFetchAndParseRss @@ -79,9 +79,9 @@ namespace NzbDrone.Core.Indexers _feedFetcher = feedFetcher; } - public List Fetch() + public List Fetch() { - var result = new List(); + var result = new List(); var indexers = _indexerService.GetAvailableIndexers(); diff --git a/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs b/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs index a6912ba9c..3cdc5d3fb 100644 --- a/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs +++ b/NzbDrone.Core/Indexers/Wombles/WomblesParser.cs @@ -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) { diff --git a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs index 7c00413b7..c9b104617 100644 --- a/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs +++ b/NzbDrone.Core/MediaFiles/EpisodeFileMovingService.cs @@ -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; diff --git a/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs b/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs index 26df92043..8c41c37ea 100644 --- a/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs +++ b/NzbDrone.Core/MediaFiles/Events/EpisodeDownloadedEvent.cs @@ -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; } diff --git a/NzbDrone.Core/Model/EpisodeParseResult.cs b/NzbDrone.Core/Model/IndexerParseResult.cs similarity index 95% rename from NzbDrone.Core/Model/EpisodeParseResult.cs rename to NzbDrone.Core/Model/IndexerParseResult.cs index 7c7edd6a3..bf3f68c35 100644 --- a/NzbDrone.Core/Model/EpisodeParseResult.cs +++ b/NzbDrone.Core/Model/IndexerParseResult.cs @@ -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 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 + { + + } } \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 0137e638f..351d49dee 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -509,7 +509,7 @@ Code - + diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 02364eb5a..be3015dfa 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -1,4 +1,4 @@ - using System; +using System; using System.Collections.Generic; using System.Globalization; using System.IO; @@ -6,9 +6,9 @@ using System.Linq; using System.Text.RegularExpressions; using NLog; using NzbDrone.Common; - using NzbDrone.Core.Qualities; - using NzbDrone.Core.Tv; - using NzbDrone.Core.Model; +using NzbDrone.Core.Qualities; +using NzbDrone.Core.Tv; +using NzbDrone.Core.Model; namespace NzbDrone.Core { @@ -91,16 +91,16 @@ namespace NzbDrone.Core private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?ita|italian)|(?german\b)|(?flemish)|(?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(fileInfo.Name); if (result == null) { Logger.Trace("Attempting to parse episode info using full path. {0}", fileInfo.FullName); - result = ParseTitle(fileInfo.FullName); + result = ParseTitle(fileInfo.FullName); } if (result != null) @@ -115,7 +115,7 @@ namespace NzbDrone.Core return result; } - internal static EpisodeParseResult ParseTitle(string title) + internal static T ParseTitle(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(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(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() @@ -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,26 +225,26 @@ 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(title); - if(parseResult == null) + if (parseResult == null) return NormalizeTitle(title); return parseResult.CleanTitle; @@ -309,7 +308,7 @@ namespace NzbDrone.Core return result; } - if(name.Contains("[WEBDL]")) + if (name.Contains("[WEBDL]")) { result.Quality = Quality.WEBDL720p; return result; @@ -327,7 +326,7 @@ namespace NzbDrone.Core if (normalizedName.Contains("x264") || normalizedName.Contains("h264") || normalizedName.Contains("720p")) { - if(normalizedName.Contains("1080p")) + if (normalizedName.Contains("1080p")) { result.Quality = Quality.HDTV1080p; return result; @@ -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) { @@ -527,7 +506,7 @@ namespace NzbDrone.Core internal static string ParseHeader(string header) { - foreach(var regex in HeaderRegex) + foreach (var regex in HeaderRegex) { var match = regex.Matches(header); diff --git a/NzbDrone.Core/Providers/DiskScanProvider.cs b/NzbDrone.Core/Providers/DiskScanProvider.cs index b3cb95931..eb8d671d9 100644 --- a/NzbDrone.Core/Providers/DiskScanProvider.cs +++ b/NzbDrone.Core/Providers/DiskScanProvider.cs @@ -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) diff --git a/NzbDrone.Core/Tv/EpisodeService.cs b/NzbDrone.Core/Tv/EpisodeService.cs index e90cc980f..83a094f5d 100644 --- a/NzbDrone.Core/Tv/EpisodeService.cs +++ b/NzbDrone.Core/Tv/EpisodeService.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.Tv Episode GetEpisode(int seriesId, DateTime date); List GetEpisodeBySeries(int seriesId); List GetEpisodesBySeason(int seriesId, int seasonNumber); - List GetEpisodesByParseResult(EpisodeParseResult parseResult); + List GetEpisodesByParseResult(ParseResult parseResult); List EpisodesWithoutFiles(bool includeSpecials); List GetEpisodesByFileId(int episodeFileId); List EpisodesWithFiles(); @@ -85,7 +85,7 @@ namespace NzbDrone.Core.Tv return _episodeRepository.GetEpisodes(seriesId, seasonNumber); } - public List GetEpisodesByParseResult(EpisodeParseResult parseResult) + public List GetEpisodesByParseResult(ParseResult parseResult) { var result = new List(); @@ -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) {