|
@@ -11,6 +11,7 @@ using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using Emby.Server.Implementations.Images;
|
|
using Emby.Server.Implementations.Images;
|
|
using MediaBrowser.Common.IO;
|
|
using MediaBrowser.Common.IO;
|
|
|
|
+using MediaBrowser.Controller.Entities.Movies;
|
|
using MediaBrowser.Controller.IO;
|
|
using MediaBrowser.Controller.IO;
|
|
using MediaBrowser.Model.IO;
|
|
using MediaBrowser.Model.IO;
|
|
using MediaBrowser.Controller.Library;
|
|
using MediaBrowser.Controller.Library;
|
|
@@ -101,4 +102,35 @@ namespace Emby.Server.Implementations.Playlists
|
|
//}
|
|
//}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public class GenreImageProvider : BaseDynamicImageProvider<Genre>
|
|
|
|
+ {
|
|
|
|
+ private readonly ILibraryManager _libraryManager;
|
|
|
|
+
|
|
|
|
+ public GenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
|
|
|
|
+ {
|
|
|
|
+ _libraryManager = libraryManager;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item)
|
|
|
|
+ {
|
|
|
|
+ var items = _libraryManager.GetItemList(new InternalItemsQuery
|
|
|
|
+ {
|
|
|
|
+ Genres = new[] { item.Name },
|
|
|
|
+ IncludeItemTypes = new[] { typeof(Series).Name, typeof(Movie).Name },
|
|
|
|
+ SortBy = new[] { ItemSortBy.Random },
|
|
|
|
+ Limit = 4,
|
|
|
|
+ Recursive = true,
|
|
|
|
+ ImageTypes = new[] { ImageType.Primary }
|
|
|
|
+
|
|
|
|
+ }).ToList();
|
|
|
|
+
|
|
|
|
+ return Task.FromResult(GetFinalItems(items));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //protected override Task<string> CreateImage(IHasImages item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
|
|
|
|
+ //{
|
|
|
|
+ // return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|