From 724e354eee2a757437bced41c4e00eeed2689240 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 23 Apr 2012 12:33:16 -0700 Subject: [PATCH] Fixed bug with RSS Item TIitle. Fixed broken tests. --- .../ProcessDailySearchResultsFixture.cs | 4 ++++ .../SearchProviderTests/ProcessSearchResultsFixture.cs | 4 ++++ NzbDrone.Core/Providers/Indexer/IndexerBase.cs | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessDailySearchResultsFixture.cs b/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessDailySearchResultsFixture.cs index 5c1f6dfb3..a1dbf2041 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessDailySearchResultsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessDailySearchResultsFixture.cs @@ -147,6 +147,7 @@ public void processSearchResults_should_skip_if_series_is_null() var parseResults = Builder.CreateListOfSize(5) .All() .With(e => e.AirDate = DateTime.Today) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithNullSeries(); @@ -167,6 +168,7 @@ public void processSearchResults_should_skip_if_series_is_mismatched() var parseResults = Builder.CreateListOfSize(5) .All() .With(e => e.AirDate = DateTime.Today) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMisMatchedSeries(); @@ -242,6 +244,7 @@ public void processSearchResults_should_skip_if_parseResult_does_not_have_airdat var parseResults = Builder.CreateListOfSize(5) .All() .With(e => e.AirDate = null) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMatchingSeries(); @@ -262,6 +265,7 @@ public void processSearchResults_should_skip_if_parseResult_airdate_does_not_mat var parseResults = Builder.CreateListOfSize(5) .All() .With(e => e.AirDate = DateTime.Today.AddDays(10)) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMatchingSeries(); diff --git a/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessSearchResultsFixture.cs b/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessSearchResultsFixture.cs index 145c8301a..a3ddf644f 100644 --- a/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessSearchResultsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/SearchProviderTests/ProcessSearchResultsFixture.cs @@ -183,6 +183,7 @@ public void processSearchResults_should_skip_if_series_is_null() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithNullSeries(); @@ -205,6 +206,7 @@ public void processSearchResults_should_skip_if_series_is_mismatched() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 1 }) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMisMatchedSeries(); @@ -227,6 +229,7 @@ public void processSearchResults_should_skip_if_season_doesnt_match() .All() .With(e => e.SeasonNumber = 2) .With(e => e.EpisodeNumbers = new List { 1 }) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMatchingSeries(); @@ -249,6 +252,7 @@ public void processSearchResults_should_skip_if_episodeNumber_doesnt_match() .All() .With(e => e.SeasonNumber = 1) .With(e => e.EpisodeNumbers = new List { 2 }) + .With(e => e.Quality = new Quality(QualityTypes.HDTV, false)) .Build(); WithMatchingSeries(); diff --git a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs index d105e7a3e..af9bf25aa 100644 --- a/NzbDrone.Core/Providers/Indexer/IndexerBase.cs +++ b/NzbDrone.Core/Providers/Indexer/IndexerBase.cs @@ -236,8 +236,11 @@ public EpisodeParseResult ParseFeed(SyndicationItem item) var title = TitlePreParser(item); var episodeParseResult = Parser.ParseTitle(title); - episodeParseResult.OriginalString = title; - if (episodeParseResult != null) episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days; + if (episodeParseResult != null) + { + episodeParseResult.Age = DateTime.Now.Date.Subtract(item.PublishDate.Date).Days; + episodeParseResult.OriginalString = title; + } _logger.Trace("Parsed: {0} from: {1}", episodeParseResult, item.Title.Text);