mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 07:22:35 +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 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||||||
.Should().Be("Sonarr");
|
.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("0SEC")]
|
||||||
[TestCase("2HD")]
|
[TestCase("2HD")]
|
||||||
[TestCase("IMMERSE")]
|
[TestCase("IMMERSE")]
|
||||||
|
@ -425,7 +425,7 @@ namespace NzbDrone.Core.Organizer
|
|||||||
{
|
{
|
||||||
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
|
tokenHandlers["{Original Title}"] = m => GetOriginalTitle(episodeFile);
|
||||||
tokenHandlers["{Original Filename}"] = m => GetOriginalFileName(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)
|
private void AddQualityTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, Series series, EpisodeFile episodeFile)
|
||||||
@ -759,6 +759,18 @@ namespace NzbDrone.Core.Organizer
|
|||||||
public string Suffix { get; set; }
|
public string Suffix { get; set; }
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
public string CustomFormat { 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
|
public enum MultiEpisodeStyle
|
||||||
|
Loading…
Reference in New Issue
Block a user