2021-05-20 19:28:18 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-06-04 15:17:36 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-12-14 06:20:19 +00:00
|
|
|
using System.Collections.Generic;
|
2020-07-01 01:44:41 +00:00
|
|
|
using Jellyfin.Data.Enums;
|
2019-12-14 06:20:19 +00:00
|
|
|
using MediaBrowser.Common.Configuration;
|
|
|
|
using MediaBrowser.Controller.Drawing;
|
|
|
|
using MediaBrowser.Controller.Dto;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using MediaBrowser.Controller.Providers;
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
using MediaBrowser.Model.Querying;
|
|
|
|
|
|
|
|
namespace Emby.Server.Implementations.Images
|
|
|
|
{
|
2020-06-04 15:13:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Class GenreImageProvider.
|
|
|
|
/// </summary>
|
2019-12-14 06:20:19 +00:00
|
|
|
public class GenreImageProvider : BaseDynamicImageProvider<Genre>
|
|
|
|
{
|
2020-06-04 15:13:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// The library manager.
|
|
|
|
/// </summary>
|
2019-12-14 06:20:19 +00:00
|
|
|
private readonly ILibraryManager _libraryManager;
|
|
|
|
|
|
|
|
public GenreImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
|
|
|
|
{
|
|
|
|
_libraryManager = libraryManager;
|
|
|
|
}
|
|
|
|
|
2020-06-04 15:13:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Get children objects used to create an genre image.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">The genre used to create the image.</param>
|
|
|
|
/// <returns>Any relevant children objects.</returns>
|
2019-12-14 06:20:19 +00:00
|
|
|
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
|
|
|
|
{
|
|
|
|
return _libraryManager.GetItemList(new InternalItemsQuery
|
|
|
|
{
|
|
|
|
Genres = new[] { item.Name },
|
2021-12-12 02:31:30 +00:00
|
|
|
IncludeItemTypes = new[] { BaseItemKind.Series, BaseItemKind.Movie },
|
2019-12-14 06:20:19 +00:00
|
|
|
OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
|
|
|
|
Limit = 4,
|
|
|
|
Recursive = true,
|
|
|
|
ImageTypes = new[] { ImageType.Primary },
|
|
|
|
DtoOptions = new DtoOptions(false)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|