diff --git a/lib/media/media_item.dart b/lib/media/media_item.dart index eb3e1bee..40184290 100644 --- a/lib/media/media_item.dart +++ b/lib/media/media_item.dart @@ -465,7 +465,12 @@ sealed class MediaItem with _$MediaItem { /// Returns hero art candidates in display-preference order. List heroArtCandidates({required double containerAspectRatio}) { - final preferred = containerAspectRatio < 1.39 ? [backgroundSquarePath, artPath] : [artPath, backgroundSquarePath]; + final preferred = switch (kind) { + MediaKind.episode when containerAspectRatio < 1.39 => [backgroundSquarePath, grandparentArtPath, artPath], + MediaKind.episode => [grandparentArtPath, artPath, backgroundSquarePath], + _ when containerAspectRatio < 1.39 => [backgroundSquarePath, artPath], + _ => [artPath, backgroundSquarePath], + }; final candidates = []; for (final path in preferred) { diff --git a/test/media/media_item_test.dart b/test/media/media_item_test.dart index a8649fd6..ed145d3f 100644 --- a/test/media/media_item_test.dart +++ b/test/media/media_item_test.dart @@ -100,6 +100,24 @@ void main() { expect(movie.heroArtCandidates(containerAspectRatio: 16 / 9), ['/art', '/square']); expect(movie.heroArt(containerAspectRatio: 16 / 9), '/art'); }); + + test('episodes prefer show art before episode art for wide hero containers', () { + final episode = MediaItem( + id: 'e1', + backend: MediaBackend.plex, + kind: MediaKind.episode, + title: 'Episode', + grandparentTitle: 'Show', + grandparentArtPath: '/show-art', + artPath: '/episode-art', + backgroundSquarePath: '/square', + serverId: 's1', + ); + + expect(episode.heroArtCandidates(containerAspectRatio: 16 / 9), ['/show-art', '/episode-art', '/square']); + expect(episode.heroArt(containerAspectRatio: 16 / 9), '/show-art'); + expect(episode.heroArtCandidates(containerAspectRatio: 1.0), ['/square', '/show-art', '/episode-art']); + }); }); group('MediaItem.isPartiallyWatched', () {