make the eligibility check more strict wrt. brackets
This commit is contained in:
parent
3824c09e77
commit
b0af11c34e
|
@ -229,15 +229,14 @@ namespace Emby.Naming.Video
|
|||
|
||||
if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName))
|
||||
{
|
||||
testFilename = cleanName.ToString();
|
||||
testFilename = cleanName.Trim().ToString();
|
||||
}
|
||||
|
||||
// The CleanStringParser should have removed common keywords etc., so if it starts with -, _ or [ it's eligible.
|
||||
// The CleanStringParser should have removed common keywords etc.
|
||||
return string.IsNullOrEmpty(testFilename)
|
||||
|| testFilename[0] == '-'
|
||||
|| testFilename[0] == '_'
|
||||
|| testFilename[0] == '['
|
||||
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
|
||||
|| Regex.IsMatch(testFilename, @"^\[([^]]*)\]");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -388,6 +388,24 @@ namespace Jellyfin.Naming.Tests.Video
|
|||
Assert.Single(result[0].AlternateVersions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_GivenUnclosedBrackets_DoesNotGroup()
|
||||
{
|
||||
var files = new[]
|
||||
{
|
||||
@"/movies/John Wick - Chapter 3 (2019)/John Wick - Kapitel 3 (2019) [Version 1].mkv",
|
||||
@"/movies/John Wick - Chapter 3 (2019)/John Wick - Kapitel 3 (2019) [Version 2.mkv"
|
||||
};
|
||||
|
||||
var result = _videoListResolver.Resolve(files.Select(i => new FileSystemMetadata
|
||||
{
|
||||
IsDirectory = false,
|
||||
FullName = i
|
||||
}).ToList()).ToList();
|
||||
|
||||
Assert.Equal(2, result.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestEmptyList()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user