diff options
Diffstat (limited to 'Emby.Server.Implementations/Library')
3 files changed, 34 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs index 2e69cd2ef..d782f5b88 100644 --- a/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs +++ b/Emby.Server.Implementations/Library/CoreResolutionIgnoreRule.cs @@ -9,6 +9,7 @@ using System.Linq; using MediaBrowser.Common.IO; using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Logging; namespace Emby.Server.Implementations.Library { @@ -19,6 +20,7 @@ namespace Emby.Server.Implementations.Library { private readonly IFileSystem _fileSystem; private readonly ILibraryManager _libraryManager; + private readonly ILogger _logger; /// <summary> /// Any folder named in this list will be ignored - can be added to at runtime for extensibility @@ -40,10 +42,11 @@ namespace Emby.Server.Implementations.Library }; - public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager) + public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager, ILogger logger) { _fileSystem = fileSystem; _libraryManager = libraryManager; + _logger = logger; } /// <summary> @@ -54,6 +57,12 @@ namespace Emby.Server.Implementations.Library /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent) { + // Don't ignore top level folders + if (fileInfo.IsDirectory && parent is AggregateFolder) + { + return false; + } + var filename = fileInfo.Name; var isHidden = fileInfo.IsHidden; var path = fileInfo.FullName; diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 5bf53fcb4..4c788a2ab 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -3084,7 +3084,11 @@ namespace Emby.Server.Implementations.Library foreach (var contentType in ConfigurationManager.Configuration.ContentTypes) { - if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase) + if (string.IsNullOrWhiteSpace(contentType.Name)) + { + removeList.Add(contentType); + } + else if (string.Equals(path, contentType.Name, StringComparison.OrdinalIgnoreCase) || _fileSystem.ContainsSubPath(path, contentType.Name)) { removeList.Add(contentType); diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 55a63b4e5..b791311f9 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -74,21 +74,21 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) { - return ResolveVideos<MusicVideo>(parent, files, directoryService, false); + return ResolveVideos<MusicVideo>(parent, files, directoryService, false, collectionType); } if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) || string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) { - return ResolveVideos<Video>(parent, files, directoryService, false); + return ResolveVideos<Video>(parent, files, directoryService, false, collectionType); } - if (string.IsNullOrEmpty(collectionType)) + if (string.IsNullOrWhiteSpace(collectionType)) { // Owned items should just use the plain video type if (parent == null) { - return ResolveVideos<Video>(parent, files, directoryService, false); + return ResolveVideos<Video>(parent, files, directoryService, false, collectionType); } if (parent is Series || parent.GetParents().OfType<Series>().Any()) @@ -96,18 +96,18 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies return null; } - return ResolveVideos<Movie>(parent, files, directoryService, false); + return ResolveVideos<Movie>(parent, files, directoryService, false, collectionType); } if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase)) { - return ResolveVideos<Movie>(parent, files, directoryService, true); + return ResolveVideos<Movie>(parent, files, directoryService, true, collectionType); } return null; } - private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions) + private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemMetadata> fileSystemEntries, IDirectoryService directoryService, bool suppportMultiEditions, string collectionType) where T : Video, new() { var files = new List<FileSystemMetadata>(); @@ -117,6 +117,16 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies // Loop through each child file/folder and see if we find a video foreach (var child in fileSystemEntries) { + // This is a hack but currently no better way to resolve a sometimes ambiguous situation + if (string.IsNullOrWhiteSpace(collectionType)) + { + if (string.Equals(child.Name, "tvshow.nfo", StringComparison.OrdinalIgnoreCase) || + string.Equals(child.Name, "season.nfo", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + } + if (child.IsDirectory) { leftOver.Add(child); @@ -408,7 +418,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies !string.Equals(collectionType, CollectionType.Photos) && !string.Equals(collectionType, CollectionType.MusicVideos); - var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion); + var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, supportsMultiVersion, collectionType) ?? + new MultiItemResolverResult(); if (result.Items.Count == 1) { |
