diff options
| author | cvium <clausvium@gmail.com> | 2021-03-10 10:47:35 +0100 |
|---|---|---|
| committer | cvium <clausvium@gmail.com> | 2021-03-10 10:47:35 +0100 |
| commit | 3824c09e774f35df18f37b56e2fc6101dc2022fe (patch) | |
| tree | 10d33e12e9f28c73e3d76df9916af3943bd6e686 /Emby.Naming/Video | |
| parent | 94db751f4b4c8d0a1847708d492a90efdaac5048 (diff) | |
fix multiversion eligibility check for complex folder names
Diffstat (limited to 'Emby.Naming/Video')
| -rw-r--r-- | Emby.Naming/Video/VideoListResolver.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs index 09a030d2d..0b44763a2 100644 --- a/Emby.Naming/Video/VideoListResolver.cs +++ b/Emby.Naming/Video/VideoListResolver.cs @@ -221,20 +221,23 @@ namespace Emby.Naming.Video string testFilename = Path.GetFileNameWithoutExtension(testFilePath); if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase)) { - if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName)) + // Remove the folder name before cleaning as we don't care about cleaning that part + if (folderName.Length <= testFilename.Length) { - testFilename = cleanName.ToString(); + testFilename = testFilename.Substring(folderName.Length).Trim(); } - if (folderName.Length <= testFilename.Length) + if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName)) { - testFilename = testFilename.Substring(folderName.Length).Trim(); + testFilename = cleanName.ToString(); } + // The CleanStringParser should have removed common keywords etc., so if it starts with -, _ or [ it's eligible. return string.IsNullOrEmpty(testFilename) - || testFilename[0] == '-' - || testFilename[0] == '_' - || string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty)); + || testFilename[0] == '-' + || testFilename[0] == '_' + || testFilename[0] == '[' + || string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty)); } return false; |
