diff --git a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs index 68df51fdd..12f333614 100644 --- a/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/MediaFileProviderTests/GetNewFilenameFixture.cs @@ -519,5 +519,59 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests //Assert result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong! (1) + Hey, Baby, What's Wrong! (2)"); } + + [Test] + public void GetNewFilename_Series_Episode_Quality_S01E05_Period() + { + //Setup + + + var fakeConfig = Mocker.GetMock(); + fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true); + fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true); + fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true); + fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2); + fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2); + fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false); + + var episode = Builder.CreateNew() + .With(e => e.Title = "City Sushi") + .With(e => e.SeasonNumber = 15) + .With(e => e.EpisodeNumber = 6) + .Build(); + + //Act + string result = Mocker.Resolve().GetNewFilename(new List { episode }, "South Park", QualityTypes.HDTV, false); + + //Assert + Assert.AreEqual("South Park.S15E06.City Sushi [HDTV]", result); + } + + [Test] + public void GetNewFilename_Episode_Quality_1x05_Period() + { + //Setup + + + var fakeConfig = Mocker.GetMock(); + fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false); + fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true); + fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true); + fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2); + fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0); + fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false); + + var episode = Builder.CreateNew() + .With(e => e.Title = "City Sushi") + .With(e => e.SeasonNumber = 15) + .With(e => e.EpisodeNumber = 6) + .Build(); + + //Act + string result = Mocker.Resolve().GetNewFilename(new List { episode }, "South Park", QualityTypes.HDTV, false); + + //Assert + Assert.AreEqual("15x06.City Sushi [HDTV]", result); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs b/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs index d0c270764..35cdcc5f2 100644 --- a/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs +++ b/NzbDrone.Core/Helpers/EpisodeSortingHelper.cs @@ -19,6 +19,12 @@ namespace NzbDrone.Core.Helpers Id = 1, Name = "Space", Pattern = " " + }, + new EpisodeSortingType + { + Id = 2, + Name = "Period", + Pattern = "." } }; diff --git a/NzbDrone.Web/Scripts/NzbDrone/settings.js b/NzbDrone.Web/Scripts/NzbDrone/settings.js index 60add8e1e..7c3a84b8c 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/settings.js +++ b/NzbDrone.Web/Scripts/NzbDrone/settings.js @@ -23,6 +23,9 @@ function createSingleEpisodeExample() { if ($("#SeparatorStyle option:selected").val() == 1) separator = ' '; + + if ($("#SeparatorStyle option:selected").val() == 2) + separator = '.'; if ($('#SeriesName').attr('checked')) { result += 'Series Name'; @@ -52,6 +55,9 @@ function createMultiEpisodeExample() { if ($("#SeparatorStyle option:selected").val() == 1) separator = ' '; + + if ($("#SeparatorStyle option:selected").val() == 2) + separator = '.'; if ($('#SeriesName').attr('checked')) { result += 'Series Name';