diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-04-14 00:43:41 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-04-14 00:43:41 -0400 |
| commit | 935de313d58c7a7ba792345c16cfd1c1aad09a78 (patch) | |
| tree | 2e9334986de5864b00d4901f031b5de6a970305e /MediaBrowser.Server.Implementations/Library/Resolvers | |
| parent | 71a4f2761e784513ae2f3dda03aa549903808ebb (diff) | |
| parent | bd253399c2f1913c544c93fd6927dee37f8add2f (diff) | |
Merge pull request #1079 from MediaBrowser/dev
3.0.5582.0
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers')
3 files changed, 22 insertions, 11 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 71daf2b0c..f88293b2a 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -64,7 +64,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies if (string.Equals(collectionType, CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) { - return ResolveVideos<Video>(parent, files, directoryService, collectionType, false); + //return ResolveVideos<Video>(parent, files, directoryService, collectionType, false); } if (string.IsNullOrEmpty(collectionType)) diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs index acae5b801..e7f239780 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoAlbumResolver.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; @@ -10,6 +11,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers { public class PhotoAlbumResolver : FolderResolver<PhotoAlbum> { + private readonly IImageProcessor _imageProcessor; + public PhotoAlbumResolver(IImageProcessor imageProcessor) + { + _imageProcessor = imageProcessor; + } + /// <summary> /// Resolves the specified args. /// </summary> @@ -32,9 +39,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return null; } - private static bool HasPhotos(ItemResolveArgs args) + private bool HasPhotos(ItemResolveArgs args) { - return args.FileSystemChildren.Any(i => ((i.Attributes & FileAttributes.Directory) != FileAttributes.Directory) && PhotoResolver.IsImageFile(i.FullName)); + return args.FileSystemChildren.Any(i => ((i.Attributes & FileAttributes.Directory) != FileAttributes.Directory) && PhotoResolver.IsImageFile(i.FullName, _imageProcessor)); } public override ResolverPriority Priority diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs index b714e968b..407aac53d 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; using System; @@ -9,6 +10,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers { public class PhotoResolver : ItemResolver<Photo> { + private readonly IImageProcessor _imageProcessor; + public PhotoResolver(IImageProcessor imageProcessor) + { + _imageProcessor = imageProcessor; + } + /// <summary> /// Resolves the specified args. /// </summary> @@ -19,7 +26,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers // Must be an image file within a photo collection if (string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase) && !args.IsDirectory && - IsImageFile(args.Path)) + IsImageFile(args.Path, _imageProcessor)) { return new Photo { @@ -30,9 +37,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return null; } - // Some common file name extensions for RAW picture files include: .cr2, .crw, .dng, .nef, .orf, .rw2, .pef, .arw, .sr2, .srf, and .tif. - protected static string[] ImageExtensions = { ".tiff", ".jpeg", ".jpg", ".png", ".aiff", ".cr2", ".crw", ".dng", ".nef", ".orf", ".pef", ".arw", ".webp" }; - private static readonly string[] IgnoreFiles = { "folder", @@ -43,12 +47,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers "poster" }; - internal static bool IsImageFile(string path) + internal static bool IsImageFile(string path, IImageProcessor imageProcessor) { var filename = Path.GetFileNameWithoutExtension(path) ?? string.Empty; return !IgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase) - && ImageExtensions.Contains(Path.GetExtension(path) ?? string.Empty, StringComparer.OrdinalIgnoreCase); + && imageProcessor.SupportedInputFormats.Contains((Path.GetExtension(path) ?? string.Empty).TrimStart('.'), StringComparer.OrdinalIgnoreCase); } } |
