fix(plex): respect per-show season display

close #1008
This commit is contained in:
edde746
2026-05-11 12:55:59 +02:00
parent d0bd919ff4
commit fd1eaf9d96
6 changed files with 136 additions and 10 deletions
+8 -9
View File
@@ -23,6 +23,7 @@ import '../exceptions/media_server_exceptions.dart';
import '../media/media_backend.dart';
import '../media/media_hub.dart';
import '../utils/provider_extensions.dart';
import '../utils/plex_season_display.dart';
import '../media/media_item.dart';
import '../media/media_item_types.dart';
import '../media/media_kind.dart';
@@ -1083,17 +1084,15 @@ class _MediaDetailScreenState extends State<MediaDetailScreen>
.map((season) => season.copyWith(serverId: serverId, serverName: _metadata.serverName ?? season.serverName))
.toList();
// Plex's flattenSeasons modes: 1 = always, 2 = single-season only.
// Jellyfin falls through to "flatten when there's a single season".
// Plex can override the library season mode per show; Jellyfin falls
// through to "flatten when there's a single season".
bool shouldShowEpisodesDirectly;
if (client is PlexClient) {
const flattenSeasonsAlways = 1;
const flattenSeasonsSingleSeason = 2;
final flattenSeasons = int.tryParse(prefs['flattenSeasons']?.toString() ?? '');
final isAlways = flattenSeasons == flattenSeasonsAlways;
final isSingleSeason = flattenSeasons == flattenSeasonsSingleSeason;
shouldShowEpisodesDirectly =
isAlways || seasonsWithServerId.isEmpty || (isSingleSeason && seasonsWithServerId.length == 1);
shouldShowEpisodesDirectly = shouldShowPlexEpisodesDirectly(
show: _metadata,
seasons: seasonsWithServerId,
libraryPrefs: prefs,
);
} else {
shouldShowEpisodesDirectly = seasonsWithServerId.length <= 1;
}