diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-10-21 12:40:32 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-21 12:40:32 -0400 |
| commit | ac63ebfb316904da9d36328340a6ef72a932eba0 (patch) | |
| tree | e5f8c73c3ba94c20bbe7e17c758bef9786ab1fb2 /Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs | |
| parent | 9b383f6b1ad57489c71e4d81d9c831d3d5960f10 (diff) | |
| parent | 7e2c52936ff15c2569a5cb6b3c5351c16c4163ff (diff) | |
Merge pull request #2966 from MediaBrowser/dev
Dev
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) |
