From 74e6d8c6e344c2f98fb411105358f3f8ed123d50 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 1 Nov 2014 23:58:32 -0700 Subject: [PATCH] Fixed: Default to dash as separator for absolute numbers in multi-episode pattern --- .../OrganizerTests/FileNameBuilderFixture.cs | 11 +++++++++++ src/NzbDrone.Core/Organizer/FileNameBuilder.cs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs index a5a348f00..1d25ca1a5 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderFixture.cs @@ -657,5 +657,16 @@ public void should_allow_space_between_season_and_episode() Subject.BuildFileName(new List { _episode1 }, _series, _episodeFile) .Should().Be("South Park - S15 E06 - City Sushi"); } + + [Test] + public void should_default_to_dash_when_serparator_is_not_set_for_absolute_number() + { + _series.SeriesType = SeriesTypes.Anime; + _namingConfig.MultiEpisodeStyle = (int)MultiEpisodeStyle.Duplicate; + _namingConfig.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - [{absolute:000}] - {Episode Title} - {Quality Title}"; + + Subject.BuildFileName(new List { _episode1, _episode2 }, _series, _episodeFile) + .Should().Be("South Park - 15x06 - 15x07 - [100-101] - City Sushi - HDTV-720p"); + } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 7ace279c7..147f0187a 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -626,7 +626,7 @@ private AbsoluteEpisodeFormat[] GetAbsoluteFormat(string pattern) return _absoluteEpisodeFormatCache.Get(pattern, () => AbsoluteEpisodePatternRegex.Matches(pattern).OfType() .Select(match => new AbsoluteEpisodeFormat { - Separator = match.Groups["separator"].Value, + Separator = match.Groups["separator"].Value.IsNotNullOrWhiteSpace() ? match.Groups["separator"].Value : "-", AbsoluteEpisodePattern = match.Groups["absolute"].Value }).ToArray()); }