Use artist backdrop for generated library image

This commit is contained in:
MrTimscampi 2021-07-03 02:50:19 +02:00
parent 1dcf03e33c
commit 8a65a6dfc3
2 changed files with 15 additions and 0 deletions

View File

@ -149,6 +149,9 @@ namespace Jellyfin.Drawing.Skia
canvas.DrawText(libraryName, width / 2f, (height / 2f) + (textPaint.FontMetrics.XHeight / 2), textPaint);
paintColor.Dispose();
textPaint.Dispose();
return bitmap;
}

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;
@ -2386,6 +2387,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);
}