Fixed: Use standard naming format for daily specials

Closes #3503
This commit is contained in:
Mark McDowall 2020-10-10 10:40:03 -07:00
parent ce3c151b8c
commit d0f0fc787e
2 changed files with 29 additions and 2 deletions

View File

@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
} }
[Test] [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}"; _namingConfig.DailyEpisodeFormat = "{Series Title} - {air-date} - {Episode Title}";
@ -297,11 +297,34 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_episode1.AirDate = "2012-12-13"; _episode1.AirDate = "2012-12-13";
_episode1.Title = "Kristen Stewart"; _episode1.Title = "Kristen Stewart";
_episode1.SeasonNumber = 1;
_episode1.EpisodeNumber = 5;
_episodeFile.SeasonNumber = 1;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart"); .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<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("The Daily Show with Jon Stewart - S00E05 - Kristen Stewart");
}
[Test] [Test]
public void should_set_airdate_to_unknown_if_not_available() public void should_set_airdate_to_unknown_if_not_available()
{ {
@ -312,6 +335,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_episode1.AirDate = null; _episode1.AirDate = null;
_episode1.Title = "Kristen Stewart"; _episode1.Title = "Kristen Stewart";
_episode1.SeasonNumber = 1;
_episode1.EpisodeNumber = 5;
_episodeFile.SeasonNumber = 1;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart"); .Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");

View File

@ -131,7 +131,7 @@ namespace NzbDrone.Core.Organizer
episodes = episodes.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber).ToList(); 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; pattern = namingConfig.DailyEpisodeFormat;
} }