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

View file

@ -19,6 +19,7 @@ using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence; using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers; 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) return GetImages(imageType)
.ElementAtOrDefault(imageIndex); .ElementAtOrDefault(imageIndex);
} }