diff options
| author | Joe Rogers <1337joe@gmail.com> | 2022-03-04 10:52:15 +0100 |
|---|---|---|
| committer | Joe Rogers <1337joe@gmail.com> | 2022-03-04 10:52:21 +0100 |
| commit | 3205e97e1e7ad6e3e84797f9575b6958d5dfc8b0 (patch) | |
| tree | 3b3028698ae483ac01318d6df33f1b2f6d4b490e /MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs | |
| parent | 136eab9b1eb56e9332b40721264f2720b97ab6c1 (diff) | |
Strip out external file fuzzy matching
Convert MediaFlagDelimiter back to char
Diffstat (limited to 'MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs')
| -rw-r--r-- | MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs index 359eb88020..d1594a9679 100644 --- a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs +++ b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs @@ -25,16 +25,6 @@ namespace MediaBrowser.Providers.MediaInfo public abstract class MediaInfoResolver { /// <summary> - /// The <see cref="CompareOptions"/> instance. - /// </summary> - private const CompareOptions CompareOptions = System.Globalization.CompareOptions.IgnoreCase | System.Globalization.CompareOptions.IgnoreNonSpace | System.Globalization.CompareOptions.IgnoreSymbols; - - /// <summary> - /// The <see cref="CompareInfo"/> instance. - /// </summary> - private readonly CompareInfo _compareInfo = CultureInfo.InvariantCulture.CompareInfo; - - /// <summary> /// The <see cref="ExternalPathParser"/> instance. /// </summary> private readonly ExternalPathParser _externalPathParser; @@ -175,11 +165,12 @@ namespace MediaBrowser.Providers.MediaInfo foreach (var file in files) { + var prefixLength = video.FileNameWithoutExtension.Length; var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file); - if (_compareInfo.IsPrefix(fileNameWithoutExtension, video.FileNameWithoutExtension, CompareOptions, out int matchLength) - && (fileNameWithoutExtension.Length == matchLength || _namingOptions.MediaFlagDelimiters.Contains(fileNameWithoutExtension[matchLength].ToString()))) + if (video.FileNameWithoutExtension.Equals(fileNameWithoutExtension[..prefixLength], StringComparison.OrdinalIgnoreCase) + && (fileNameWithoutExtension.Length == prefixLength || _namingOptions.MediaFlagDelimiters.Contains(fileNameWithoutExtension[prefixLength]))) { - var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[matchLength..]); + var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[prefixLength..]); if (externalPathInfo != null) { |
