瀏覽代碼

Additional fixes for multiple movies per folder. Added a provider shell

Luke Pulverenti 12 年之前
父節點
當前提交
34bf41721a

+ 9 - 0
MediaBrowser.Controller/Entities/TV/Episode.cs

@@ -22,6 +22,15 @@ namespace MediaBrowser.Controller.Entities.TV
             }
         }
 
+        [IgnoreDataMember]
+        protected override bool UseParentPathToCreateResolveArgs
+        {
+            get
+            {
+                return true;
+            }
+        }
+
         /// <summary>
         /// We want to group into series not show individually in an index
         /// </summary>

+ 2 - 1
MediaBrowser.Controller/Resolvers/BaseVideoResolver.cs

@@ -45,7 +45,8 @@ namespace MediaBrowser.Controller.Resolvers
                     return new TVideoType
                     {
                         VideoType = type,
-                        Path = args.Path
+                        Path = args.Path,
+                        IsInMixedFolder = true
                     };
                 }
             }

+ 95 - 0
MediaBrowser.Providers/ImageFromMixedMediaLocationProvider.cs

@@ -0,0 +1,95 @@
+using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.Library;
+using MediaBrowser.Controller.Providers;
+using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Logging;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Providers
+{
+    class ImageFromMixedMediaLocationProvider : BaseMetadataProvider
+    {
+        public ImageFromMixedMediaLocationProvider(ILogManager logManager, IServerConfigurationManager configurationManager)
+            : base(logManager, configurationManager)
+        {
+        }
+
+        public override ItemUpdateType ItemUpdateType
+        {
+            get
+            {
+                return ItemUpdateType.ImageUpdate;
+            }
+        }
+
+        /// <summary>
+        /// Supportses the specified item.
+        /// </summary>
+        /// <param name="item">The item.</param>
+        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
+        public override bool Supports(BaseItem item)
+        {
+            if (item.LocationType != LocationType.FileSystem || item.ResolveArgs.IsDirectory)
+            {
+                return false;
+            }
+
+            var video = item as Video;
+
+            if (video != null && !(item is Episode))
+            {
+                return video.IsInMixedFolder;
+            }
+
+            var game = item as Game;
+
+            if (game != null)
+            {
+                return game.IsInMixedFolder;
+            }
+
+            return false;
+        }
+
+        /// <summary>
+        /// Gets the priority.
+        /// </summary>
+        /// <value>The priority.</value>
+        public override MetadataProviderPriority Priority
+        {
+            get { return MetadataProviderPriority.First; }
+        }
+
+        /// <summary>
+        /// Returns true or false indicating if the provider should refresh when the contents of it's directory changes
+        /// </summary>
+        /// <value><c>true</c> if [refresh on file system stamp change]; otherwise, <c>false</c>.</value>
+        protected override bool RefreshOnFileSystemStampChange
+        {
+            get
+            {
+                return true;
+            }
+        }
+
+        /// <summary>
+        /// Gets the filestamp extensions.
+        /// </summary>
+        /// <value>The filestamp extensions.</value>
+        protected override string[] FilestampExtensions
+        {
+            get
+            {
+                return BaseItem.SupportedImageExtensions;
+            }
+        }
+
+        public override Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
+        {
+            return TrueTaskResult;
+        }
+    }
+}

+ 1 - 0
MediaBrowser.Providers/MediaBrowser.Providers.csproj

@@ -52,6 +52,7 @@
     <Compile Include="FolderProviderFromXml.cs" />
     <Compile Include="Games\GameProviderFromXml.cs" />
     <Compile Include="ImageFromMediaLocationProvider.cs" />
+    <Compile Include="ImageFromMixedMediaLocationProvider.cs" />
     <Compile Include="ImagesByNameProvider.cs" />
     <Compile Include="MediaInfo\AudioImageProvider.cs" />
     <Compile Include="MediaInfo\BaseFFProbeProvider.cs" />

+ 8 - 5
MediaBrowser.Server.Implementations/Providers/ImageSaver.cs

@@ -242,13 +242,16 @@ namespace MediaBrowser.Server.Implementations.Providers
 
             if (saveLocally)
             {
-                var video = item as Video;
-
-                if (video != null && video.IsInMixedFolder)
+                if (!(item is Episode))
                 {
-                    var folder = Path.GetDirectoryName(video.Path);
+                    var video = item as Video;
+
+                    if (video != null && video.IsInMixedFolder)
+                    {
+                        var folder = Path.GetDirectoryName(video.Path);
 
-                    path = Path.Combine(folder, Path.GetFileNameWithoutExtension(video.Path) + "-" + filename);
+                        path = Path.Combine(folder, Path.GetFileNameWithoutExtension(video.Path) + "-" + filename);
+                    }
                 }
 
                 if (string.IsNullOrEmpty(path) && !string.IsNullOrEmpty(item.MetaLocation))