Pārlūkot izejas kodu

Use artist backdrop for generated library image

MrTimscampi 4 gadi atpakaļ
vecāks
revīzija
8a65a6dfc3

+ 3 - 0
Jellyfin.Drawing.Skia/StripCollageBuilder.cs

@@ -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;
         }
 

+ 12 - 0
MediaBrowser.Controller/Entities/BaseItem.cs

@@ -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);
         }