1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Don't use Sonarr as ReleaseGroup if the pattern contains an advanced prefix/suffix.

This commit is contained in:
Taloth Saldono 2016-02-18 21:55:45 +01:00
parent 59c68ec6cc
commit f005edfcf0
2 changed files with 25 additions and 1 deletions

View File

@ -712,6 +712,18 @@ public void should_use_Sonarr_as_release_group_when_not_available()
.Should().Be("Sonarr");
}
[TestCase("{Episode Title}{-Release Group}", "City Sushi")]
[TestCase("{Episode Title}{ Release Group}", "City Sushi")]
[TestCase("{Episode Title}{ [Release Group]}", "City Sushi")]
public void should_not_use_Sonarr_as_release_group_if_pattern_has_separator(string pattern, string expectedFileName)
{
_episodeFile.ReleaseGroup = null;
_namingConfig.StandardEpisodeFormat = pattern;
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
.Should().Be(expectedFileName);
}
[TestCase("0SEC")]
[TestCase("2HD")]
[TestCase("IMMERSE")]

View File

@ -425,7 +425,7 @@ private void AddEpisodeFileTokens(Dictionary<string, Func<TokenMatch, string>> t
{
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
tokenHandlers["{Original Filename}"] = m => GetOriginalFileName(episodeFile);
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? "Sonarr";
tokenHandlers["{Release Group}"] = m => episodeFile.ReleaseGroup ?? m.DefaultValue("Sonarr");
}
private void AddQualityTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, Series series, EpisodeFile episodeFile)
@ -759,6 +759,18 @@ internal sealed class TokenMatch
public string Suffix { get; set; }
public string Token { get; set; }
public string CustomFormat { get; set; }
public string DefaultValue(string defaultValue)
{
if (string.IsNullOrEmpty(Prefix) && string.IsNullOrEmpty(Suffix))
{
return defaultValue;
}
else
{
return string.Empty;
}
}
}
public enum MultiEpisodeStyle