aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs12
-rw-r--r--tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs2
2 files changed, 11 insertions, 3 deletions
diff --git a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
index e88b88cea..40b45faf5 100644
--- a/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
+++ b/MediaBrowser.Providers/MediaInfo/MediaInfoResolver.cs
@@ -44,6 +44,11 @@ namespace MediaBrowser.Providers.MediaInfo
private readonly IMediaEncoder _mediaEncoder;
/// <summary>
+ /// The <see cref="NamingOptions"/> instance.
+ /// </summary>
+ private readonly NamingOptions _namingOptions;
+
+ /// <summary>
/// The <see cref="DlnaProfileType"/> of the files this resolver should resolve.
/// </summary>
private readonly DlnaProfileType _type;
@@ -62,6 +67,7 @@ namespace MediaBrowser.Providers.MediaInfo
DlnaProfileType type)
{
_mediaEncoder = mediaEncoder;
+ _namingOptions = namingOptions;
_type = type;
_externalPathParser = new ExternalPathParser(namingOptions, localizationManager, _type);
}
@@ -159,9 +165,11 @@ namespace MediaBrowser.Providers.MediaInfo
foreach (var file in files)
{
- if (_compareInfo.IsPrefix(Path.GetFileNameWithoutExtension(file), video.FileNameWithoutExtension, CompareOptions, out int matchLength))
+ var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
+ if (_compareInfo.IsPrefix(fileNameWithoutExtension, video.FileNameWithoutExtension, CompareOptions, out int matchLength)
+ && (fileNameWithoutExtension.Length == matchLength || _namingOptions.MediaFlagDelimiters.Contains(fileNameWithoutExtension[matchLength].ToString())))
{
- var externalPathInfo = _externalPathParser.ParseFile(file, Path.GetFileNameWithoutExtension(file)[matchLength..]);
+ var externalPathInfo = _externalPathParser.ParseFile(file, fileNameWithoutExtension[matchLength..]);
if (externalPathInfo != null)
{
diff --git a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
index 02bf878a0..926ec5c91 100644
--- a/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
+++ b/tests/Jellyfin.Providers.Tests/MediaInfo/MediaInfoResolverTests.cs
@@ -113,7 +113,7 @@ public class MediaInfoResolverTests
[InlineData("My.Video.mp3")]
[InlineData("My.Video.png")]
[InlineData("My.Video.txt")]
- // [InlineData("My.Video Sequel.srt")]
+ [InlineData("My.Video Sequel.srt")]
[InlineData("Some.Other.Video.srt")]
public void GetExternalFiles_FuzzyMatching_RejectsNonMatches(string file)
{