|
|
@ -16,8 +16,10 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|
|
|
public class FileNameBuilderFixture : CoreTest<FileNameBuilder>
|
|
|
|
public class FileNameBuilderFixture : CoreTest<FileNameBuilder>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private Series _series;
|
|
|
|
private Series _series;
|
|
|
|
|
|
|
|
private Episode _episode1;
|
|
|
|
private NamingConfig namingConfig;
|
|
|
|
private Episode _episode2;
|
|
|
|
|
|
|
|
private EpisodeFile _episodeFile;
|
|
|
|
|
|
|
|
private NamingConfig _namingConfig;
|
|
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
[SetUp]
|
|
|
|
public void Setup()
|
|
|
|
public void Setup()
|
|
|
@ -28,571 +30,190 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namingConfig = new NamingConfig();
|
|
|
|
_namingConfig = new NamingConfig();
|
|
|
|
namingConfig.RenameEpisodes = true;
|
|
|
|
_namingConfig.RenameEpisodes = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<INamingConfigService>()
|
|
|
|
Mocker.GetMock<INamingConfigService>()
|
|
|
|
.Setup(c => c.GetConfig()).Returns(namingConfig);
|
|
|
|
.Setup(c => c.GetConfig()).Returns(_namingConfig);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
_episode1 = Builder<Episode>.CreateNew()
|
|
|
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_episode2 = Builder<Episode>.CreateNew()
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_Episode_Quality_1x05_Dash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("15x06 - City Sushi [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_Series_Quality_01x05_Space()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 1;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park 05x06 [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_Series_s01e05_Space()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 3;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_episodeFile = new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) };
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park s05e06");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
private void GivenProper()
|
|
|
|
public void GetNewFilename_Series_Episode_s01e05_Periods()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_episodeFile.Quality.Proper = true;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 3;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South.Park.s05e06.City.Sushi");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
|
|
|
public void should_replace_Series_space_Title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 3;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
result.Should().Be("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]");
|
|
|
|
.Should().Be("South Park");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_S01E05_Dash()
|
|
|
|
public void should_replace_Series_underscore_Title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series_Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
.Should().Be("South_Park");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("S15E06");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
|
|
|
public void should_replace_Series_dot_Title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series.Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
.Should().Be("South.Park");
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
|
|
|
public void should_replace_Series_dash_Title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series-Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
.Should().Be("South-Park");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("3x23x24 - Strawberries and Cream [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
|
|
|
public void should_replace_SERIES_TITLE_with_all_caps()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{SERIES TITLE}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("SOUTH PARK");
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("3x23x24 Strawberries and Cream [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
|
|
|
public void should_replace_series_title_with_all_lower_case()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{series title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 3;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = true;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream");
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("south park");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
|
|
|
public void should_replace_episode_title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Episode Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = true;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("City Sushi");
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("The.Mentalist.-.S03E23-24");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
|
|
|
public void should_replace_season_number_with_single_digit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{episode}";
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = true;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
.Should().Be("1x6");
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("3x23x24");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
|
|
|
public void should_replace_0season_number_with_two_digits()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{0season}x{episode}";
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.Should().Be("01x6");
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
|
|
|
public void should_replace_episode_number_with_single_digit()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{episode}";
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("1x6");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
|
|
|
public void should_replace_0episode_number_with_two_digits()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_episode1.SeasonNumber = 1;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{season}x{0episode}";
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p, true) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi");
|
|
|
|
.Should().Be("1x06");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
|
|
|
public void should_replace_quality_title()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
.Should().Be("HDTV-720p");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
|
|
|
public void should_replace_quality_title_with_proper()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Quality Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_episodeFile.Quality.Proper = true;
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = ".";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("HDTV-720p Proper");
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("South Park.S15E06.City Sushi [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_Episode_Quality_1x05_Period()
|
|
|
|
public void should_replace_all_contents_in_pattern()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title} [{Quality Title}]";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = "."; ;
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("15x06.City Sushi [HDTV-720p]");
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1}, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
|
|
|
public void use_file_name_when_sceneName_is_null()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.RenameEpisodes = false;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_episodeFile.Path = @"C:\Test\TV\30 Rock - S01E01 - Test";
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = "."; ;
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.RenameEpisodes = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.SceneName = null)
|
|
|
|
|
|
|
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be(Path.GetFileNameWithoutExtension(_episodeFile.Path));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
|
|
|
public void use_file_name_when_sceneName_is_not_null()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = false;
|
|
|
|
_namingConfig.RenameEpisodes = false;
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_episodeFile.SceneName = "30.Rock.S01E01.xvid-LOL";
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
_episodeFile.Path = @"C:\Test\TV\30 Rock - S01E01 - Test";
|
|
|
|
namingConfig.Separator = ".";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 0;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.RenameEpisodes = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
.Should().Be("30.Rock.S01E01.xvid-LOL");
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.SceneName = "30.Rock.S01E01.xvid-LOL")
|
|
|
|
|
|
|
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be(episodeFile.SceneName);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
|
|
|
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
@ -607,163 +228,91 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
Subject.BuildFilename(new List<Episode> {episode2, episode}, new Series {Title = "30 Rock"}, _episodeFile)
|
|
|
|
|
|
|
|
.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
|
|
|
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
_episode1.Title = "Hello";
|
|
|
|
.With(e => e.Title = "Hello")
|
|
|
|
_episode2.Title = "World";
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "World")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1, _episode2}, _series, _episodeFile)
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
|
|
|
.Should().Be("South Park - S15E06-E07 - Hello + World");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
|
|
|
public void should_use_airDate_if_series_isDaily()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_namingConfig.DailyEpisodeFormat = "{Series Title} - {air-date} - {Episode Title}";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
_series.Title = "The Daily Show with Jon Stewart";
|
|
|
|
.With(e => e.Title = "Hello (3)")
|
|
|
|
_series.SeriesType = SeriesTypes.Daily;
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
_episode1.AirDate = "2012-12-13";
|
|
|
|
.With(e => e.Title = "Hello (2)")
|
|
|
|
_episode1.Title = "Kristen Stewart";
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode3 = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.Title = "World")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 8)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = Subject.BuildFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
|
|
|
.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_use_airDate_if_series_isDaily()
|
|
|
|
public void should_set_airdate_to_unknown_if_not_available()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_namingConfig.DailyEpisodeFormat = "{Series Title} - {Air-Date} - {Episode Title}";
|
|
|
|
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
_series.Title = "The Daily Show with Jon Stewart";
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
_series.SeriesType = SeriesTypes.Daily;
|
|
|
|
namingConfig.IncludeQuality = true;
|
|
|
|
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
_episode1.AirDate = null;
|
|
|
|
.CreateNew()
|
|
|
|
_episode1.Title = "Kristen Stewart";
|
|
|
|
.With(s => s.SeriesType = SeriesTypes.Daily)
|
|
|
|
|
|
|
|
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodes = Builder<Episode>
|
|
|
|
|
|
|
|
.CreateListOfSize(1)
|
|
|
|
|
|
|
|
.All()
|
|
|
|
|
|
|
|
.With(e => e.AirDate = "2012-12-13")
|
|
|
|
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = Subject
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1 }, _series, _episodeFile)
|
|
|
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_use_airDate_if_series_isDaily_no_episode_title()
|
|
|
|
public void should_format_extend_multi_episode_properly()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
|
|
|
|
_namingConfig.MultiEpisodeStyle = 0;
|
|
|
|
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
Subject.BuildFilename(new List<Episode> {_episode1, _episode2}, _series, _episodeFile)
|
|
|
|
namingConfig.IncludeEpisodeTitle = false;
|
|
|
|
.Should().Be("South Park - S15E06-07 - City Sushi");
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
}
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
|
|
|
|
.CreateNew()
|
|
|
|
|
|
|
|
.With(s => s.SeriesType = SeriesTypes.Daily)
|
|
|
|
|
|
|
|
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodes = Builder<Episode>
|
|
|
|
[Test]
|
|
|
|
.CreateListOfSize(1)
|
|
|
|
public void should_format_duplicate_multi_episode_properly()
|
|
|
|
.All()
|
|
|
|
{
|
|
|
|
.With(e => e.AirDate = "2012-12-13")
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
_namingConfig.MultiEpisodeStyle = 1;
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = Subject
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
|
|
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
.Should().Be("South Park - S15E06 - S15E07 - City Sushi");
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_set_airdate_to_unknown_if_not_available()
|
|
|
|
public void should_format_repeat_multi_episode_properly()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
|
|
|
|
_namingConfig.MultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
|
|
namingConfig.IncludeSeriesTitle = true;
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
|
|
|
namingConfig.IncludeEpisodeTitle = true;
|
|
|
|
.Should().Be("South Park - S15E06E07 - City Sushi");
|
|
|
|
namingConfig.IncludeQuality = false;
|
|
|
|
}
|
|
|
|
namingConfig.Separator = " - ";
|
|
|
|
|
|
|
|
namingConfig.NumberStyle = 2;
|
|
|
|
|
|
|
|
namingConfig.ReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
|
|
|
|
.CreateNew()
|
|
|
|
|
|
|
|
.With(s => s.SeriesType = SeriesTypes.Daily)
|
|
|
|
|
|
|
|
.With(s => s.Title = "The Daily Show with Jon Stewart")
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodes = Builder<Episode>
|
|
|
|
[Test]
|
|
|
|
.CreateListOfSize(1)
|
|
|
|
public void should_format_scene_multi_episode_properly()
|
|
|
|
.All()
|
|
|
|
{
|
|
|
|
.With(e => e.AirDate = null)
|
|
|
|
_namingConfig.StandardEpisodeFormat = "{Series Title} - S{0season}E{0episode} - {Episode Title}";
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
_namingConfig.MultiEpisodeStyle = 3;
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = Subject
|
|
|
|
Subject.BuildFilename(new List<Episode> { _episode1, _episode2 }, _series, _episodeFile)
|
|
|
|
.BuildFilename(episodes, series, new EpisodeFile { Quality = new QualityModel(Quality.HDTV720p) });
|
|
|
|
.Should().Be("South Park - S15E06-E07 - City Sushi");
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|