mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-24 22:48:56 +02:00
generate genre images
This commit is contained in:
parent
fb7c7c578d
commit
8931b949f8
|
@ -258,7 +258,7 @@ namespace Emby.Server.Implementations.Images
|
||||||
{
|
{
|
||||||
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
|
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);
|
return await CreateSquareCollage(item, itemsWithImages, outputPath).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue