add image provider for artists

This commit is contained in:
dkanada 2019-12-14 15:01:43 +09:00
parent 8d7e9ab515
commit aa66444264
2 changed files with 25 additions and 1 deletions

View File

@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.Images
if (imageType == ImageType.Primary)
{
if (item is UserView || item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum)
if (item is UserView || item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum || item is MusicArtist)
{
return CreateSquareCollage(item, itemsWithImages, outputPath);
}

View File

@ -67,6 +67,30 @@ namespace Emby.Server.Implementations.Playlists
}
}
public class MusicArtistImageProvider : BaseDynamicImageProvider<MusicArtist>
{
private readonly ILibraryManager _libraryManager;
public MusicArtistImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor, ILibraryManager libraryManager) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
{
_libraryManager = libraryManager;
}
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
return _libraryManager.GetItemList(new InternalItemsQuery
{
ArtistIds = new[] { item.Id },
IncludeItemTypes = new[] { typeof(MusicAlbum).Name },
OrderBy = new[] { (ItemSortBy.Random, SortOrder.Ascending) },
Limit = 4,
Recursive = true,
ImageTypes = new[] { ImageType.Primary },
DtoOptions = new DtoOptions(false)
});
}
}
public class MusicGenreImageProvider : BaseDynamicImageProvider<MusicGenre>
{
private readonly ILibraryManager _libraryManager;