1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Don't include year 0 in series folder name

Fixes #3057
This commit is contained in:
Mark McDowall 2019-04-17 22:25:41 -07:00
parent 478e13b0fd
commit 4933a75d15
4 changed files with 39 additions and 0 deletions

View File

@ -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");
}
}
}

View File

@ -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");
}
}
}

View File

@ -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");
}
}
}

View File

@ -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))
{