1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 01:37:07 +00:00

New: Added a single period as a separator when naming episodes.

This commit is contained in:
Mark McDowall 2012-04-14 17:17:36 -07:00
parent 5ed53008c6
commit 8618117926
3 changed files with 66 additions and 0 deletions

View file

@ -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<ConfigProvider>();
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<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
.With(e => e.SeasonNumber = 15)
.With(e => e.EpisodeNumber = 6)
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { 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<ConfigProvider>();
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<Episode>.CreateNew()
.With(e => e.Title = "City Sushi")
.With(e => e.SeasonNumber = 15)
.With(e => e.EpisodeNumber = 6)
.Build();
//Act
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
//Assert
Assert.AreEqual("15x06.City Sushi [HDTV]", result);
}
}
}

View file

@ -19,6 +19,12 @@ namespace NzbDrone.Core.Helpers
Id = 1,
Name = "Space",
Pattern = " "
},
new EpisodeSortingType
{
Id = 2,
Name = "Period",
Pattern = "."
}
};

View file

@ -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';