diff options
| author | hatharry <hatharry@hotmail.com> | 2016-08-28 12:51:32 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-28 12:51:32 +0000 |
| commit | c974641a352685b2e6595dd7b291843c8e6364ac (patch) | |
| tree | 2e6ca83c4d08c5b676e12edae947e635d290bc3f /MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs | |
| parent | f21f9923de6291aaf985f32dbbbaddbb26d07fb1 (diff) | |
| parent | 81765ff29f624fd34e1abe3c7bb8149bbb001aef (diff) | |
Merge pull request #22 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs index 9dd30edde..3f9475480 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs @@ -6,6 +6,8 @@ using System; using System.IO; using System.Linq; using CommonIO; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Model.Configuration; namespace MediaBrowser.Server.Implementations.Library.Resolvers { @@ -32,15 +34,16 @@ namespace MediaBrowser.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)) + (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) && args.GetLibraryOptions().EnablePhotos)) { if (IsImageFile(args.Path, _imageProcessor)) { var filename = Path.GetFileNameWithoutExtension(args.Path); // Make sure the image doesn't belong to a video file - if (args.DirectoryService.GetFiles(Path.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(i, filename))) + if (args.DirectoryService.GetFiles(Path.GetDirectoryName(args.Path)).Any(i => IsOwnedByMedia(args.GetLibraryOptions(), i, filename))) { return null; } @@ -56,9 +59,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return null; } - private bool IsOwnedByMedia(FileSystemMetadata file, string imageFilename) + private bool IsOwnedByMedia(LibraryOptions libraryOptions, FileSystemMetadata file, string imageFilename) { - if (_libraryManager.IsVideoFile(file.FullName) && imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file.Name), StringComparison.OrdinalIgnoreCase)) + if (_libraryManager.IsVideoFile(file.FullName, libraryOptions) && imageFilename.StartsWith(Path.GetFileNameWithoutExtension(file.Name), StringComparison.OrdinalIgnoreCase)) { return true; } |
