fix(jellyfin): stop overriding a server subtitle mode of None

Jellyfin answers PlaybackInfo with a null DefaultSubtitleStreamIndex when the
user's SubtitleMode is None: the index is the server's whole answer, and null
means it picked no subtitle. The mapper read null as "the server did not say"
and promoted the container's default/forced flags to a server selection
instead, which outranks the profile subtitle mode in the selection ladder. A
viewer who had turned subtitles off for their Jellyfin user got them switched
back on by every item that carried a default or forced row.

Only the row the server names is selected now. A stream the viewer picks, and
an explicit off, still survive per item because Plezy reports the index
through playback progress and the server hands it back as that index or -1.

close #1779
This commit is contained in:
edde746
2026-08-03 17:07:05 +02:00
parent bbaf5f0f9e
commit e7aa1e4782
3 changed files with 93 additions and 6 deletions
+11 -4
View File
@@ -70,12 +70,19 @@ List<MediaAudioTrack> _withDefaultAudioSelection(List<MediaAudioTrack> tracks, i
return [for (final track in tracks) track.withSelected(track.index == defaultStreamIndex)];
}
/// Marks the row Jellyfin selected for this user, and only that row.
///
/// `DefaultSubtitleStreamIndex` is the server's whole answer: it folds in the
/// user's `SubtitleMode`, their language preference, and any per-item choice
/// Plezy persisted through playback progress reports (including `-1` for a
/// deliberate off). A null index is part of that answer — "play no subtitle" —
/// not a missing field. Synthesising a selection from the container's
/// default/forced flags overrode `SubtitleMode: None` at the server-selected
/// priority, so a user who turned subtitles off on the server had them
/// switched back on by every fresh item (#1779).
List<MediaSubtitleTrack> _withDefaultSubtitleSelection(List<MediaSubtitleTrack> tracks, int? defaultStreamIndex) {
return [
for (final track in tracks)
track.withSelected(
defaultStreamIndex != null ? track.index == defaultStreamIndex : track.selected || track.forced,
),
for (final track in tracks) track.withSelected(defaultStreamIndex != null && track.index == defaultStreamIndex),
];
}