diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-10-21 12:39:52 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-10-21 12:39:52 -0400 |
| commit | e7ecd418c43b966bac3c34d09e6f97c1176a749c (patch) | |
| tree | 00e9fbb89b26ad38cc8a8c867bb2ea6413e53c15 /Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs | |
| parent | 0cf4f01dc72b3775e3af067ed1eef51c683a3c02 (diff) | |
update home video library support
Diffstat (limited to 'Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs index 04312f277..48f5802a9 100644 --- a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs @@ -35,7 +35,6 @@ namespace Emby.Server.Implementations.Library.Resolvers // Must be an image file within a photo collection var collectionType = args.GetCollectionType(); - if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase) || (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos)) { @@ -44,9 +43,15 @@ namespace Emby.Server.Implementations.Library.Resolvers var filename = Path.GetFileNameWithoutExtension(args.Path); // Make sure the image doesn't belong to a video file - if (_fileSystem.GetFilePaths(_fileSystem.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename))) + var files = args.DirectoryService.GetFiles(_fileSystem.GetDirectoryName(args.Path)); + var libraryOptions = args.GetLibraryOptions(); + + foreach (var file in files) { - return null; + if (IsOwnedByMedia(_libraryManager, libraryOptions, file.FullName, filename)) + { + return null; + } } return new Photo @@ -60,14 +65,21 @@ namespace Emby.Server.Implementations.Library.Resolvers return null; } - private bool IsOwnedByMedia(LibraryOptions libraryOptions, string file, string imageFilename) + internal static bool IsOwnedByMedia(ILibraryManager libraryManager, LibraryOptions libraryOptions, string file, string imageFilename) { - if (_libraryManager.IsVideoFile(file, libraryOptions)) + if (libraryManager.IsVideoFile(file, libraryOptions)) { - if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase)) - { - return true; - } + return IsOwnedByResolvedMedia(libraryManager, libraryOptions, file, imageFilename); + } + + return false; + } + + internal static bool IsOwnedByResolvedMedia(ILibraryManager libraryManager, LibraryOptions libraryOptions, string file, string imageFilename) + { + if (imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file), StringComparison.OrdinalIgnoreCase)) + { + return true; } return false; @@ -81,7 +93,8 @@ namespace Emby.Server.Implementations.Library.Resolvers "fanart", "backdrop", "poster", - "cover" + "cover", + "logo" }; internal static bool IsImageFile(string path, IImageProcessor imageProcessor) |
