fix(tv): prefer show art for episode backdrops

close #1123
This commit is contained in:
edde746
2026-05-25 21:08:33 +02:00
parent 9365fcf246
commit 50be8565d9
2 changed files with 24 additions and 1 deletions
+6 -1
View File
@@ -465,7 +465,12 @@ sealed class MediaItem with _$MediaItem {
/// Returns hero art candidates in display-preference order.
List<String> 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 = <String>[];
for (final path in preferred) {
+18
View File
@@ -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', () {