mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
parent
478e13b0fd
commit
4933a75d15
@ -58,5 +58,16 @@ public void should_get_expected_title_back(string title, int year, string expect
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_include_0_for_year()
|
||||
{
|
||||
_series.Title = "The Alienist";
|
||||
_series.Year = 0;
|
||||
_namingConfig.StandardEpisodeFormat = "{Series CleanTitleYear}";
|
||||
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be("The Alienist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,5 +59,16 @@ public void should_get_expected_title_back(string title, int year, string expect
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_include_0_for_year()
|
||||
{
|
||||
_series.Title = "The Alienist";
|
||||
_series.Year = 0;
|
||||
_namingConfig.StandardEpisodeFormat = "{Series TitleTheYear}";
|
||||
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be("Alienist, The");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,5 +58,16 @@ public void should_get_expected_title_back(string title, int year, string expect
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be(expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_include_0_for_year()
|
||||
{
|
||||
_series.Title = "The Alienist";
|
||||
_series.Year = 0;
|
||||
_namingConfig.StandardEpisodeFormat = "{Series TitleYear}";
|
||||
|
||||
Subject.BuildFileName(new List<Episode> { _episode }, _series, _episodeFile)
|
||||
.Should().Be("The Alienist");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,6 +286,12 @@ public static string TitleThe(string title)
|
||||
|
||||
public static string TitleYear(string title, int year)
|
||||
{
|
||||
// Don't use 0 for the year.
|
||||
if (year == 0)
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
// Regex match incase the year in the title doesn't match the year, for whatever reason.
|
||||
if (YearRegex.IsMatch(title))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user