From 6aa3a37153d04de91799d9cfc792e1f503eefe95 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 13 May 2015 10:43:34 -0400 Subject: [PATCH] restore photo album images --- .../Photos/PhotoAlbumImageProvider.cs | 39 ++++++------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs index 9d2eb297f8..b55c76b8f8 100644 --- a/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs +++ b/MediaBrowser.Server.Implementations/Photos/PhotoAlbumImageProvider.cs @@ -1,44 +1,27 @@ -using MediaBrowser.Controller.Entities; +using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.Drawing; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; -using MediaBrowser.Model.Entities; using System.Collections.Generic; using System.Linq; -using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.Photos { - public class PhotoAlbumImageProvider : IDynamicImageProvider + public class PhotoAlbumImageProvider : BaseDynamicImageProvider { - public IEnumerable GetSupportedImages(IHasImages item) + public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) + : base(fileSystem, providerManager, applicationPaths, imageProcessor) { - return new List { ImageType.Primary }; } - public Task GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken) + protected override Task> GetItemsWithImages(IHasImages item) { - var album = (PhotoAlbum)item; + var photoAlbum = (PhotoAlbum)item; + var items = GetFinalItems(photoAlbum.Children.ToList()); - var image = album.Children - .OfType() - .Select(i => i.GetImagePath(type)) - .FirstOrDefault(i => !string.IsNullOrEmpty(i)); - - return Task.FromResult(new DynamicImageResponse - { - Path = image, - HasImage = !string.IsNullOrEmpty(image) - }); - } - - public string Name - { - get { return "Image Extractor"; } - } - - public bool Supports(IHasImages item) - { - return item is PhotoAlbum; + return Task.FromResult(items); } } }