Plex treats a subtitle stream as forced when its title says "Forced" even with the API flag unset. Every forced comparison now uses that effective forced-ness on both sides: the match scorer, the low-metadata hard gate, the Jellyfin OnlyForced/Smart profile modes, and stream-index negotiation. Carrying a track choice into the next episode no longer reuses the same-item identity matchers. A sealed SubtitlePreference (off / track reference / semantic intent) replaces the id-'navigation' pseudo-track through the whole preference channel, and cross-item intents hard-require language and forced-class parity. When the next episode has no track of the same class, the intent declines and selection falls through to the server's own per-episode choice instead of latching onto a full track by position and persisting that mistake back to the server. Intents wait for pending native tracks under the same catalog-completeness rule as source ids, so an early decline cannot retire the selection listener before the real track arrives. Ref #1716
44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:plezy/media/media_source_info.dart';
|
|
import 'package:plezy/mpv/mpv.dart';
|
|
import 'package:plezy/utils/subtitle_forced_semantics.dart';
|
|
|
|
MediaSubtitleTrack _row({bool forced = false, String? title, String? displayTitle}) =>
|
|
MediaSubtitleTrack(id: 1, selected: false, forced: forced, title: title, displayTitle: displayTitle);
|
|
|
|
void main() {
|
|
group('MediaSubtitleTrack.effectiveForced', () {
|
|
test('flag alone qualifies', () {
|
|
expect(_row(forced: true).effectiveForced, isTrue);
|
|
});
|
|
|
|
test('title alone qualifies', () {
|
|
expect(_row(title: 'FR Forced').effectiveForced, isTrue);
|
|
});
|
|
|
|
test('displayTitle alone qualifies', () {
|
|
expect(_row(displayTitle: 'Français (Forced SRT)').effectiveForced, isTrue);
|
|
});
|
|
|
|
test('neither flag nor title qualifies', () {
|
|
expect(_row(title: 'French', displayTitle: 'Français (SRT)').effectiveForced, isFalse);
|
|
expect(_row().effectiveForced, isFalse);
|
|
});
|
|
});
|
|
|
|
group('SubtitleTrack.effectiveForced', () {
|
|
test('flag alone qualifies', () {
|
|
expect(const SubtitleTrack(id: '1', isForced: true).effectiveForced, isTrue);
|
|
});
|
|
|
|
test('title alone qualifies', () {
|
|
expect(const SubtitleTrack(id: '1', title: 'FR Forced [ASS]').effectiveForced, isTrue);
|
|
});
|
|
|
|
test('plain title does not qualify', () {
|
|
expect(const SubtitleTrack(id: '1', title: 'French').effectiveForced, isFalse);
|
|
expect(const SubtitleTrack(id: '1').effectiveForced, isFalse);
|
|
});
|
|
});
|
|
}
|