Преглед на файлове

do not resolve episode-like files if they are in extras folders

cvium преди 4 години
родител
ревизия
ab0cff8556

+ 1 - 1
Emby.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs

@@ -30,7 +30,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
         /// </summary>
         /// <param name="args">The args.</param>
         /// <returns>`0.</returns>
-        protected override T Resolve(ItemResolveArgs args)
+        public override T Resolve(ItemResolveArgs args)
         {
             return ResolveVideo<T>(args, false);
         }

+ 1 - 1
Emby.Server.Implementations/Library/Resolvers/Books/BookResolver.cs

@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
     {
         private readonly string[] _validExtensions = { ".azw", ".azw3", ".cb7", ".cbr", ".cbt", ".cbz", ".epub", ".mobi", ".pdf" };
 
-        protected override Book Resolve(ItemResolveArgs args)
+        public override Book Resolve(ItemResolveArgs args)
         {
             var collectionType = args.GetCollectionType();
 

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

@@ -69,6 +69,110 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
             return result;
         }
 
+        /// <summary>
+        /// Resolves the specified args.
+        /// </summary>
+        /// <param name="args">The args.</param>
+        /// <returns>Video.</returns>
+        public override Video Resolve(ItemResolveArgs args)
+        {
+            var collectionType = args.GetCollectionType();
+
+            // Find movies with their own folders
+            if (args.IsDirectory)
+            {
+                if (IsInvalid(args.Parent, collectionType))
+                {
+                    return null;
+                }
+
+                var files = args.FileSystemChildren
+                    .Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
+                    .ToList();
+
+                if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
+                {
+                    return FindMovie<MusicVideo>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
+                }
+
+                if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
+                {
+                    return FindMovie<Video>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
+                }
+
+                if (string.IsNullOrEmpty(collectionType))
+                {
+                    // Owned items will be caught by the plain video resolver
+                    if (args.Parent == null)
+                    {
+                        // return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
+                        return null;
+                    }
+
+                    if (args.HasParent<Series>())
+                    {
+                        return null;
+                    }
+
+                    {
+                        return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
+                    }
+                }
+
+                if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
+                {
+                    return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
+                }
+
+                return null;
+            }
+
+            // Handle owned items
+            if (args.Parent == null)
+            {
+                return base.Resolve(args);
+            }
+
+            if (IsInvalid(args.Parent, collectionType))
+            {
+                return null;
+            }
+
+            Video item = null;
+
+            if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
+            {
+                item = ResolveVideo<MusicVideo>(args, false);
+            }
+
+            // To find a movie file, the collection type must be movies or boxsets
+            else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
+            {
+                item = ResolveVideo<Movie>(args, true);
+            }
+            else if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
+                string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
+            {
+                item = ResolveVideo<Video>(args, false);
+            }
+            else if (string.IsNullOrEmpty(collectionType))
+            {
+                if (args.HasParent<Series>())
+                {
+                    return null;
+                }
+
+                item = ResolveVideo<Video>(args, false);
+            }
+
+            if (item != null)
+            {
+                item.IsInMixedFolder = true;
+            }
+
+            return item;
+        }
+
         private MultiItemResolverResult ResolveMultipleInternal(
             Folder parent,
             List<FileSystemMetadata> files,
@@ -216,110 +320,6 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
             return string.Equals(result.Path, file.FullName, StringComparison.OrdinalIgnoreCase);
         }
 
-        /// <summary>
-        /// Resolves the specified args.
-        /// </summary>
-        /// <param name="args">The args.</param>
-        /// <returns>Video.</returns>
-        protected override Video Resolve(ItemResolveArgs args)
-        {
-            var collectionType = args.GetCollectionType();
-
-            // Find movies with their own folders
-            if (args.IsDirectory)
-            {
-                if (IsInvalid(args.Parent, collectionType))
-                {
-                    return null;
-                }
-
-                var files = args.FileSystemChildren
-                    .Where(i => !LibraryManager.IgnoreFile(i, args.Parent))
-                    .ToList();
-
-                if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
-                {
-                    return FindMovie<MusicVideo>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
-                }
-
-                if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase))
-                {
-                    return FindMovie<Video>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, false);
-                }
-
-                if (string.IsNullOrEmpty(collectionType))
-                {
-                    // Owned items will be caught by the plain video resolver
-                    if (args.Parent == null)
-                    {
-                        // return FindMovie<Video>(args.Path, args.Parent, files, args.DirectoryService, collectionType);
-                        return null;
-                    }
-
-                    if (args.HasParent<Series>())
-                    {
-                        return null;
-                    }
-
-                    {
-                        return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
-                    }
-                }
-
-                if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
-                {
-                    return FindMovie<Movie>(args, args.Path, args.Parent, files, args.DirectoryService, collectionType, true);
-                }
-
-                return null;
-            }
-
-            // Handle owned items
-            if (args.Parent == null)
-            {
-                return base.Resolve(args);
-            }
-
-            if (IsInvalid(args.Parent, collectionType))
-            {
-                return null;
-            }
-
-            Video item = null;
-
-            if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase))
-            {
-                item = ResolveVideo<MusicVideo>(args, false);
-            }
-
-            // To find a movie file, the collection type must be movies or boxsets
-            else if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase))
-            {
-                item = ResolveVideo<Movie>(args, true);
-            }
-            else if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) ||
-                string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase))
-            {
-                item = ResolveVideo<Video>(args, false);
-            }
-            else if (string.IsNullOrEmpty(collectionType))
-            {
-                if (args.HasParent<Series>())
-                {
-                    return null;
-                }
-
-                item = ResolveVideo<Video>(args, false);
-            }
-
-            if (item != null)
-            {
-                item.IsInMixedFolder = true;
-            }
-
-            return item;
-        }
-
         /// <summary>
         /// Sets the initial item values.
         /// </summary>

+ 7 - 5
Emby.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs

@@ -1,5 +1,6 @@
 using System;
 using System.Linq;
+using MediaBrowser.Controller.Entities;
 using MediaBrowser.Controller.Entities.TV;
 using MediaBrowser.Controller.Library;
 using MediaBrowser.Model.Entities;
@@ -16,7 +17,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
         /// </summary>
         /// <param name="args">The args.</param>
         /// <returns>Episode.</returns>
-        protected override Episode Resolve(ItemResolveArgs args)
+        public override Episode Resolve(ItemResolveArgs args)
         {
             var parent = args.Parent;
 
@@ -34,11 +35,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
                 season = parent.GetParents().OfType<Season>().FirstOrDefault();
             }
 
-            // If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something
+            // If the parent is a Season or Series and the parent is not an extras folder, then this is an Episode if the VideoResolver returns something
             // Also handle flat tv folders
-            if (season != null ||
-                string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
-                args.HasParent<Series>())
+            if ((season != null ||
+                 string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
+                 args.HasParent<Series>())
+                && !BaseItem.AllExtrasTypesFolderNames.Contains(parent.Name, StringComparer.OrdinalIgnoreCase))
             {
                 var episode = ResolveVideo<Episode>(args, false);
 

+ 1 - 1
MediaBrowser.Controller/Resolvers/BaseItemResolver.cs

@@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Resolvers
         /// </summary>
         /// <param name="args">The args.</param>
         /// <returns>`0.</returns>
-        protected virtual T Resolve(ItemResolveArgs args)
+        public virtual T Resolve(ItemResolveArgs args)
         {
             return null;
         }