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/PhotoAlbumResolver.cs | |
| parent | 9b383f6b1ad57489c71e4d81d9c831d3d5960f10 (diff) | |
| parent | 7e2c52936ff15c2569a5cb6b3c5351c16c4163ff (diff) | |
Merge pull request #2966 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs index 3d7ede879..a9cfea34d 100644 --- a/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs @@ -12,9 +12,12 @@ namespace Emby.Server.Implementations.Library.Resolvers public class PhotoAlbumResolver : FolderResolver<PhotoAlbum> { private readonly IImageProcessor _imageProcessor; - public PhotoAlbumResolver(IImageProcessor imageProcessor) + private ILibraryManager _libraryManager; + + public PhotoAlbumResolver(IImageProcessor imageProcessor, ILibraryManager libraryManager) { _imageProcessor = imageProcessor; + _libraryManager = libraryManager; } /// <summary> @@ -25,14 +28,18 @@ namespace Emby.Server.Implementations.Library.Resolvers protected override PhotoAlbum Resolve(ItemResolveArgs args) { // Must be an image file within a photo collection - if (args.IsDirectory && string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) + if (args.IsDirectory) { - if (HasPhotos(args)) + if (string.Equals(args.GetCollectionType(), CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase) || + string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) { - return new PhotoAlbum + if (HasPhotos(args)) { - Path = args.Path - }; + return new PhotoAlbum + { + Path = args.Path + }; + } } } @@ -41,7 +48,32 @@ namespace Emby.Server.Implementations.Library.Resolvers private bool HasPhotos(ItemResolveArgs args) { - return args.FileSystemChildren.Any(i => (!i.IsDirectory) && PhotoResolver.IsImageFile(i.FullName, _imageProcessor)); + var files = args.FileSystemChildren; + + foreach (var file in files) + { + if (!file.IsDirectory && PhotoResolver.IsImageFile(file.FullName, _imageProcessor)) + { + var libraryOptions = args.GetLibraryOptions(); + var filename = file.Name; + var ownedByMedia = false; + + foreach (var siblingFile in files) + { + if (PhotoResolver.IsOwnedByMedia(_libraryManager, libraryOptions, siblingFile.FullName, filename)) + { + ownedByMedia = true; + break; + } + } + + if (!ownedByMedia) + { + return true; + } + } + } + return false; } public override ResolverPriority Priority |
