From d0f0fc787e61c9beb126133c1838de5e25ab12d6 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 10 Oct 2020 10:40:03 -0700 Subject: [PATCH] Fixed: Use standard naming format for daily specials Closes #3503 --- .../FileNameBuilderFixture.cs | 29 ++++++++++++++++++- .../Organizer/FileNameBuilder.cs | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs index 4f7cfc692..64f6bfad5 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs @@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests } [Test] - public void should_use_airDate_if_series_isDaily() + public void should_use_airDate_if_series_isDaily_and_not_a_special() { _namingConfig.DailyEpisodeFormat = "{Series Title} - {air-date} - {Episode Title}"; @@ -297,11 +297,34 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests _episode1.AirDate = "2012-12-13"; _episode1.Title = "Kristen Stewart"; + _episode1.SeasonNumber = 1; + _episode1.EpisodeNumber = 5; + + _episodeFile.SeasonNumber = 1; Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile) .Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart"); } + [Test] + public void should_use_standard_if_series_isDaily_special() + { + _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; + + _series.Title = "The Daily Show with Jon Stewart"; + _series.SeriesType = SeriesTypes.Daily; + + _episode1.AirDate = "2012-12-13"; + _episode1.Title = "Kristen Stewart"; + _episode1.SeasonNumber = 0; + _episode1.EpisodeNumber = 5; + + _episodeFile.SeasonNumber = 0; + + Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile) + .Should().Be("The Daily Show with Jon Stewart - S00E05 - Kristen Stewart"); + } + [Test] public void should_set_airdate_to_unknown_if_not_available() { @@ -312,6 +335,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests _episode1.AirDate = null; _episode1.Title = "Kristen Stewart"; + _episode1.SeasonNumber = 1; + _episode1.EpisodeNumber = 5; + + _episodeFile.SeasonNumber = 1; Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile) .Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart"); diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 63ccd282d..6e7185924 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -131,7 +131,7 @@ namespace NzbDrone.Core.Organizer episodes = episodes.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber).ToList(); - if (series.SeriesType == SeriesTypes.Daily) + if (series.SeriesType == SeriesTypes.Daily && episodeFile.SeasonNumber > 0) { pattern = namingConfig.DailyEpisodeFormat; }