Fixed: Multi-episode style is used when renaming multi episode anime

This commit is contained in:
Mark McDowall 2014-07-14 23:06:06 -07:00
parent 6483e0951c
commit 1368c4376b
2 changed files with 34 additions and 4 deletions

View File

@ -478,13 +478,13 @@ namespace NzbDrone.Core.Test.OrganizerTests
}
[Test]
public void should_replace_multiple_absolute_numbering_when_series_is_anime()
public void should_use_dash_as_separator_when_multi_episode_style_is_extend_for_anime()
{
_series.SeriesType = SeriesTypes.Anime;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFilename(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - 100 - 101 - City Sushi");
.Should().Be("South Park - 100-101 - City Sushi");
}
[Test]
@ -499,5 +499,16 @@ namespace NzbDrone.Core.Test.OrganizerTests
Subject.BuildFilename(new List<Episode> { _episode1, }, _series, _episodeFile)
.Should().Be("South Park - 15x06 - City Sushi");
}
[Test]
public void should_duplicate_absolute_pattern_when_multi_episode_style_is_duplicate()
{
_series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = (int)MultiEpisodeStyle.Duplicate;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFilename(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - 100 - 101 - City Sushi");
}
}
}

View File

@ -183,8 +183,27 @@ namespace NzbDrone.Core.Organizer
foreach (var episode in sortedEpisodes.Skip(1))
{
absoluteEpisodePattern += absoluteEpisodeFormat.Separator +
absoluteEpisodeFormat.AbsoluteEpisodePattern;
switch ((MultiEpisodeStyle)namingConfig.MultiEpisodeStyle)
{
case MultiEpisodeStyle.Duplicate:
absoluteEpisodePattern += absoluteEpisodeFormat.Separator +
absoluteEpisodeFormat.AbsoluteEpisodePattern;
break;
case MultiEpisodeStyle.Repeat:
absoluteEpisodePattern += absoluteEpisodeFormat.Separator +
absoluteEpisodeFormat.AbsoluteEpisodePattern;
break;
case MultiEpisodeStyle.Scene:
absoluteEpisodePattern += "-" + absoluteEpisodeFormat.AbsoluteEpisodePattern;
break;
//MultiEpisodeStyle.Extend
default:
absoluteEpisodePattern += "-" + absoluteEpisodeFormat.AbsoluteEpisodePattern;
break;
}
episodeTitles.Add(episode.Title.TrimEnd(EpisodeTitleTrimCharaters));
}