Use enum for MultiEpisodeStyle property

pull/5578/head
Mark McDowall 2 years ago
parent ed7d99c160
commit d3ad970ecc

@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_not_collapse_episode_titles_when_episode_titles_are_not_the_same() public void should_not_collapse_episode_titles_when_episode_titles_are_not_the_same()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 3; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Scene;
_episode1.Title = "Hello"; _episode1.Title = "Hello";
_episode2.Title = "World"; _episode2.Title = "World";

@ -386,7 +386,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_trim_periods_from_end_of_episode_title() public void should_trim_periods_from_end_of_episode_title()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 3; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Scene;
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "Part 1.") .With(e => e.Title = "Part 1.")
@ -402,7 +402,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_trim_question_marks_from_end_of_episode_title() public void should_trim_question_marks_from_end_of_episode_title()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 3; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Scene;
var episode = Builder<Episode>.CreateNew() var episode = Builder<Episode>.CreateNew()
.With(e => e.Title = "Part 1?") .With(e => e.Title = "Part 1?")

@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_duplicate_multi_episode_properly() public void should_format_duplicate_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 1; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Duplicate;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - S15E06 - S15E07 - City Sushi"); .Should().Be("South Park - S15E06 - S15E07 - City Sushi");
@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_repeat_multi_episode_properly() public void should_format_repeat_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 2; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Repeat;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - S15E06E07 - City Sushi"); .Should().Be("South Park - S15E06E07 - City Sushi");
@ -117,7 +117,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_scene_multi_episode_properly() public void should_format_scene_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 3; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Scene;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - S15E06-E07 - City Sushi"); .Should().Be("South Park - S15E06-E07 - City Sushi");
@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_duplicate_absolute_pattern_when_multi_episode_style_is_duplicate() public void should_duplicate_absolute_pattern_when_multi_episode_style_is_duplicate()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = (int)MultiEpisodeStyle.Duplicate; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Duplicate;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
@ -149,7 +149,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{ {
_namingConfig.StandardEpisodeFormat = _namingConfig.StandardEpisodeFormat =
"{Series Title} - S{season:00}E{episode:00} - ({Quality Title}, {MediaInfo Full}, {Release Group}) - {Episode Title}"; "{Series Title} - S{season:00}E{episode:00} - ({Quality Title}, {MediaInfo Full}, {Release Group}) - {Episode Title}";
_namingConfig.MultiEpisodeStyle = (int)MultiEpisodeStyle.Duplicate; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Duplicate;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
.Should().Be("South Park - S15E06 - S15E07 - (HDTV-720p, , SonarrTest) - City Sushi"); .Should().Be("South Park - S15E06 - S15E07 - (HDTV-720p, , SonarrTest) - City Sushi");
@ -159,7 +159,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_range_multi_episode_properly() public void should_format_range_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 4; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Range;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park - S15E06-08 - City Sushi"); .Should().Be("South Park - S15E06-08 - City Sushi");
@ -169,7 +169,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_range_multi_episode_anime_properly() public void should_format_range_multi_episode_anime_properly()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = 4; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Range;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
@ -180,7 +180,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_repeat_multi_episode_anime_properly() public void should_format_repeat_multi_episode_anime_properly()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = 2; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Repeat;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
@ -191,7 +191,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_single_episode_with_range_multi_episode_properly() public void should_format_single_episode_with_range_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 4; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Range;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("South Park - S15E06 - City Sushi"); .Should().Be("South Park - S15E06 - City Sushi");
@ -201,7 +201,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_single_anime_episode_with_range_multi_episode_properly() public void should_format_single_anime_episode_with_range_multi_episode_properly()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = 4; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Range;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
@ -212,7 +212,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_default_to_dash_when_serparator_is_not_set_for_absolute_number() public void should_default_to_dash_when_serparator_is_not_set_for_absolute_number()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = (int)MultiEpisodeStyle.Duplicate; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Duplicate;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - [{absolute:000}] - {Episode Title} - {Quality Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {season}x{episode:00} - [{absolute:000}] - {Episode Title} - {Quality Title}";
Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
@ -223,7 +223,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_prefixed_range_multi_episode_properly() public void should_format_prefixed_range_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 5; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park - S15E06-E08 - City Sushi"); .Should().Be("South Park - S15E06-E08 - City Sushi");
@ -233,7 +233,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_prefixed_range_multi_episode_anime_properly() public void should_format_prefixed_range_multi_episode_anime_properly()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = 5; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
@ -244,7 +244,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_single_episode_with_prefixed_range_multi_episode_properly() public void should_format_single_episode_with_prefixed_range_multi_episode_properly()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 5; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be("South Park - S15E06 - City Sushi"); .Should().Be("South Park - S15E06 - City Sushi");
@ -254,7 +254,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_single_anime_episode_with_prefixed_range_multi_episode_properly() public void should_format_single_anime_episode_with_prefixed_range_multi_episode_properly()
{ {
_series.SeriesType = SeriesTypes.Anime; _series.SeriesType = SeriesTypes.Anime;
_namingConfig.MultiEpisodeStyle = 5; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange;
_namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}"; _namingConfig.AnimeEpisodeFormat = "{Series Title} - {absolute:000} - {Episode Title}";
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
@ -265,7 +265,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_prefixed_range_multi_episode_using_episode_separator() public void should_format_prefixed_range_multi_episode_using_episode_separator()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} - {season:0}x{episode:00} - {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} - {season:0}x{episode:00} - {Episode Title}";
_namingConfig.MultiEpisodeStyle = 5; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park - 15x06-x08 - City Sushi"); .Should().Be("South Park - 15x06-x08 - City Sushi");
@ -275,7 +275,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
public void should_format_range_multi_episode_wrapped_in_brackets() public void should_format_range_multi_episode_wrapped_in_brackets()
{ {
_namingConfig.StandardEpisodeFormat = "{Series Title} (S{season:00}E{episode:00}) {Episode Title}"; _namingConfig.StandardEpisodeFormat = "{Series Title} (S{season:00}E{episode:00}) {Episode Title}";
_namingConfig.MultiEpisodeStyle = 4; _namingConfig.MultiEpisodeStyle = MultiEpisodeStyle.Range;
Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile) Subject.BuildFileName(new List<Episode> { _episode1, _episode2, _episode3 }, _series, _episodeFile)
.Should().Be("South Park (S15E06-08) City Sushi"); .Should().Be("South Park (S15E06-08) City Sushi");

@ -8,7 +8,7 @@ namespace NzbDrone.Core.Organizer
{ {
RenameEpisodes = false, RenameEpisodes = false,
ReplaceIllegalCharacters = true, ReplaceIllegalCharacters = true,
MultiEpisodeStyle = 5, MultiEpisodeStyle = MultiEpisodeStyle.PrefixedRange,
StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Full}", StandardEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Full}",
DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title} {Quality Full}", DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title} {Quality Full}",
AnimeEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Full}", AnimeEpisodeFormat = "{Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Full}",
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Organizer
public bool RenameEpisodes { get; set; } public bool RenameEpisodes { get; set; }
public bool ReplaceIllegalCharacters { get; set; } public bool ReplaceIllegalCharacters { get; set; }
public int MultiEpisodeStyle { get; set; } public MultiEpisodeStyle MultiEpisodeStyle { get; set; }
public string StandardEpisodeFormat { get; set; } public string StandardEpisodeFormat { get; set; }
public string DailyEpisodeFormat { get; set; } public string DailyEpisodeFormat { get; set; }
public string AnimeEpisodeFormat { get; set; } public string AnimeEpisodeFormat { get; set; }

@ -1,4 +1,4 @@
using NzbDrone.Core.Organizer; using NzbDrone.Core.Organizer;
namespace Sonarr.Api.V3.Config namespace Sonarr.Api.V3.Config
{ {
@ -24,7 +24,7 @@ namespace Sonarr.Api.V3.Config
RenameEpisodes = model.RenameEpisodes, RenameEpisodes = model.RenameEpisodes,
ReplaceIllegalCharacters = model.ReplaceIllegalCharacters, ReplaceIllegalCharacters = model.ReplaceIllegalCharacters,
MultiEpisodeStyle = model.MultiEpisodeStyle, MultiEpisodeStyle = (int)model.MultiEpisodeStyle,
StandardEpisodeFormat = model.StandardEpisodeFormat, StandardEpisodeFormat = model.StandardEpisodeFormat,
DailyEpisodeFormat = model.DailyEpisodeFormat, DailyEpisodeFormat = model.DailyEpisodeFormat,
AnimeEpisodeFormat = model.AnimeEpisodeFormat, AnimeEpisodeFormat = model.AnimeEpisodeFormat,
@ -59,7 +59,7 @@ namespace Sonarr.Api.V3.Config
RenameEpisodes = resource.RenameEpisodes, RenameEpisodes = resource.RenameEpisodes,
ReplaceIllegalCharacters = resource.ReplaceIllegalCharacters, ReplaceIllegalCharacters = resource.ReplaceIllegalCharacters,
MultiEpisodeStyle = resource.MultiEpisodeStyle, MultiEpisodeStyle = (MultiEpisodeStyle)resource.MultiEpisodeStyle,
StandardEpisodeFormat = resource.StandardEpisodeFormat, StandardEpisodeFormat = resource.StandardEpisodeFormat,
DailyEpisodeFormat = resource.DailyEpisodeFormat, DailyEpisodeFormat = resource.DailyEpisodeFormat,
AnimeEpisodeFormat = resource.AnimeEpisodeFormat, AnimeEpisodeFormat = resource.AnimeEpisodeFormat,

Loading…
Cancel
Save