Skip to content

substitute: never swap away a forced subtitle track - #210

Open
frindle wants to merge 1 commit into
mainfrom
substitute-forced-subs
Open

frindle wants to merge 1 commit into
mainfrom
substitute-forced-subs

Conversation

@frindle

@frindle frindle commented Dec 4, 2026

Copy link
Copy Markdown
Owner

The gap

probe.parse() recorded embedded subtitles as language only, so the forced flag was dropped. substitute.same_cut() compared subtitle languages only, so a replacement carrying a full English track could replace our file with a forced English track (the one that translates foreign-language parts) and the swap passed.

The change

  • probe.parse adds subs_forced: languages of subtitle tracks flagged forced, by ffmpeg's (forced) stream flag or a stream title containing "forced". subs is unchanged.
  • same_cut refuses when ours has a forced track in a language the new file has no forced track for. If ours has forced tracks and the new file's forced tracks cannot be read (no subs_forced), it refuses. Facts without subs_forced on our side behave as before.
  • Readers of subs/probe dict checked: substitute.py (own_facts, _langs_covered, journal counts) only; none affected.

Proof

  • Tests extended: tiering/offload/tests/test_probe.py (flag and title forms, subs unchanged), tiering/offload/tests/test_substitute_round2.py (refuse cases, unreadable, ok cases). Whole tiering/offload suite run on claude-sandbox.
  • Read-only runner job 0731 (plex-ro) runs the new and old parse over library file heads and reports scanned / with forced / old-would-lose counts.

probe.parse keeps a parallel subs_forced list (ffmpeg's (forced) flag or a stream title containing
forced); same_cut refuses a replacement that lacks a forced track ours has, or whose forced tracks
cannot be read.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant