generate genre images

This commit is contained in:
Luke Pulverenti 2017-03-10 13:32:38 -05:00
parent fb7c7c578d
commit 8931b949f8
2 changed files with 33 additions and 1 deletions

View File

@ -258,7 +258,7 @@ namespace Emby.Server.Implementations.Images
{
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
}
if (item is Playlist || item is MusicGenre)
if (item is Playlist || item is MusicGenre || item is Genre || item is GameGenre)
{
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
}

View File

@ -11,6 +11,7 @@ using System.Linq;
using System.Threading.Tasks;
using Emby.Server.Implementations.Images;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
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);
//}
}
}