Browse Source

Backport pull request #14955 from jellyfin/release-10.11.z

Fix tmdbid not detected in single movie folder

Original-merge: def5956cd1afe8848c0e232fa477720c4158832f

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
theguymadmax 3 days ago
parent
commit
06fb300cff

+ 7 - 4
Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs

@@ -369,13 +369,16 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
                 // We need to only look at the name of this actual item (not parents)
                 // We need to only look at the name of this actual item (not parents)
                 var justName = item.IsInMixedFolder ? Path.GetFileName(item.Path.AsSpan()) : Path.GetFileName(item.ContainingFolderPath.AsSpan());
                 var justName = item.IsInMixedFolder ? Path.GetFileName(item.Path.AsSpan()) : Path.GetFileName(item.ContainingFolderPath.AsSpan());
 
 
-                if (!justName.IsEmpty)
+                var tmdbid = justName.GetAttributeValue("tmdbid");
+
+                // If not in a mixed folder and ID not found in folder path, check filename
+                if (string.IsNullOrEmpty(tmdbid) && !item.IsInMixedFolder)
                 {
                 {
-                    // Check for TMDb id
-                    var tmdbid = justName.GetAttributeValue("tmdbid");
-                    item.TrySetProviderId(MetadataProvider.Tmdb, tmdbid);
+                    tmdbid = Path.GetFileName(item.Path.AsSpan()).GetAttributeValue("tmdbid");
                 }
                 }
 
 
+                item.TrySetProviderId(MetadataProvider.Tmdb, tmdbid);
+
                 if (!string.IsNullOrEmpty(item.Path))
                 if (!string.IsNullOrEmpty(item.Path))
                 {
                 {
                     // Check for IMDb id - we use full media path, as we can assume that this will match in any use case (whether  id in parent dir or in file name)
                     // Check for IMDb id - we use full media path, as we can assume that this will match in any use case (whether  id in parent dir or in file name)