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:
parent
59c68ec6cc
commit
f005edfcf0
@ -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")]
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user