Merge pull request #6257 from MrTimscampi/music-library-backdrop

Use artist backdrop for generated library image
This commit is contained in:
dkanada 2021-09-06 02:30:49 +09:00 committed by GitHub
commit b8eb8940c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -112,7 +112,7 @@ namespace Jellyfin.Drawing.Skia
canvas.DrawImage(residedBackdrop, 0, 0);
// draw shadow rectangle
var paintColor = new SKPaint
using var paintColor = new SKPaint
{
Color = SKColors.Black.WithAlpha(0x78),
Style = SKPaintStyle.Fill
@ -130,7 +130,7 @@ namespace Jellyfin.Drawing.Skia
}
// draw library name
var textPaint = new SKPaint
using var textPaint = new SKPaint
{
Color = SKColors.White,
Style = SKPaintStyle.Fill,

View File

@ -19,6 +19,7 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
@ -2439,6 +2440,17 @@ namespace MediaBrowser.Controller.Entities
};
}
// Music albums usually don't have dedicated backdrops, so return one from the artist instead
if (GetType() == typeof(MusicAlbum) && imageType == ImageType.Backdrop)
{
var artist = FindParent<MusicArtist>();
if (artist != null)
{
return artist.GetImages(imageType).ElementAtOrDefault(imageIndex);
}
}
return GetImages(imageType)
.ElementAtOrDefault(imageIndex);
}