From a5a02ce90e5c86bb56c22986d1f85aa628baf14f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 23 Dec 2013 20:17:20 -0800 Subject: [PATCH] Fixed: Incorrectly treating single episode releases as full season releases --- src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs | 13 ++++++++++--- src/NzbDrone.Core/Parser/Parser.cs | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 7686d8d87..7da18d33d 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -106,6 +106,7 @@ namespace NzbDrone.Core.Test.ParserTests result.EpisodeNumbers.First().Should().Be(episodeNumber); result.SeriesTitle.Should().Be(title.CleanSeriesTitle()); result.AbsoluteEpisodeNumbers.Should().BeEmpty(); + result.FullSeason.Should().BeFalse(); } [TestCase(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)] @@ -129,6 +130,8 @@ namespace NzbDrone.Core.Test.ParserTests result.EpisodeNumbers.Should().HaveCount(1); result.SeasonNumber.Should().Be(season); result.EpisodeNumbers[0].Should().Be(episode); + result.AbsoluteEpisodeNumbers.Should().BeEmpty(); + result.FullSeason.Should().BeFalse(); ExceptionVerification.IgnoreWarns(); } @@ -169,6 +172,8 @@ namespace NzbDrone.Core.Test.ParserTests result.SeasonNumber.Should().Be(season); result.EpisodeNumbers.Should().BeEquivalentTo(episodes); result.SeriesTitle.Should().Be(title.CleanSeriesTitle()); + result.AbsoluteEpisodeNumbers.Should().BeEmpty(); + result.FullSeason.Should().BeFalse(); } @@ -190,6 +195,8 @@ namespace NzbDrone.Core.Test.ParserTests result.SeriesTitle.Should().Be(title.CleanSeriesTitle()); result.AirDate.Should().Be(airDate.ToString(Episode.AIR_DATE_FORMAT)); result.EpisodeNumbers.Should().BeEmpty(); + result.AbsoluteEpisodeNumbers.Should().BeEmpty(); + result.FullSeason.Should().BeFalse(); } [TestCase("[SubDESU]_High_School_DxD_07_(1280x720_x264-AAC)_[6B7FD717]", "High School DxD", 7, 0, 0)] @@ -222,9 +229,9 @@ namespace NzbDrone.Core.Test.ParserTests result.SeasonNumber.Should().Be(seasonNumber); result.EpisodeNumbers.FirstOrDefault().Should().Be(episodeNumber); result.SeriesTitle.Should().Be(title.CleanSeriesTitle()); + result.FullSeason.Should().BeFalse(); } - [TestCase("Conan {year} {month} {day} Emma Roberts HDTV XviD BFF")] [TestCase("The Tonight Show With Jay Leno {year} {month} {day} 1080i HDTV DD5 1 MPEG2 TrollHD")] [TestCase("The.Daily.Show.{year}.{month}.{day}.Johnny.Knoxville.iTouch-MW")] @@ -238,7 +245,6 @@ namespace NzbDrone.Core.Test.ParserTests Parser.Parser.ParseTitle(yearTooLow).Should().BeNull(); } - [TestCase("Conan {year} {month} {day} Emma Roberts HDTV XviD BFF")] [TestCase("The Tonight Show With Jay Leno {year} {month} {day} 1080i HDTV DD5 1 MPEG2 TrollHD")] [TestCase("The.Daily.Show.{year}.{month}.{day}.Johnny.Knoxville.iTouch-MW")] @@ -274,7 +280,8 @@ namespace NzbDrone.Core.Test.ParserTests var result = Parser.Parser.ParseTitle(postTitle); result.SeasonNumber.Should().Be(season); result.SeriesTitle.Should().Be(title.CleanSeriesTitle()); - result.EpisodeNumbers.Length.Should().Be(0); + result.EpisodeNumbers.Should().BeEmpty(); + result.AbsoluteEpisodeNumbers.Should().BeEmpty(); result.FullSeason.Should().BeTrue(); } diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index c0618bb5b..593e349d9 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -336,7 +336,8 @@ namespace NzbDrone.Core.Parser var count = last - first + 1; result.AbsoluteEpisodeNumbers = Enumerable.Range(first, count).ToArray(); } - else + + if (!episodeCaptures.Any() && !absoluteEpisodeCaptures.Any()) { //Check to see if this is an "Extras" or "SUBPACK" release, if it is, return NULL //Todo: Set a "Extras" flag in EpisodeParseResult if we want to download them ever