Per review: 'prefer_audio_track' reads like the prefer_60fps/prefer_hdr
booleans, but this is a pick-one choice. Renamed to audio_track and
regenerated the migration (as 0038_source_audio_track) - it had drifted
after the switch to single-letter values: default='original' and the long
choices under max_length=1 would fail the AddField back-fill on Postgres.
Also addresses the lint findings in the touched files:
- matching.py: collapse nested prefer_60fps/prefer_hdr ifs (SIM102),
fold matched_resolution and the video fallback branches (SIM114)
- test_frontend.py: str.removeprefix, dict.values(), and a DTZ001 noqa
on the deliberately naive datetime that make_aware() wraps
New metadata_multi_audio fixture (English original + Spanish default
tracks) drives tests for get_best_audio_format, get_best_combined_format
and the video+audio split path under both preference values, plus a
regression guard that marker-free metadata is unaffected and a unit test
for the new parse_media_format flags.
Refs #1468
get_best_combined_format and get_best_audio_format now pick the audio
track (original vs the publisher's default) that the source asked for,
and get_fallback_id takes a prefer= kwarg for the shared tie-break.
- combined: replaces PR #1452's hard-coded 'prefer original' with the
per-source choice (identical behaviour while the field defaults to
'original')
- audio-only: the track preference is now applied among codec-matched
formats, where before only the codec mattered; a codec match still
wins over the track preference
- when no format carries an (original)/(default) marker (a single-track
video) every path behaves exactly as before
Fixes#1468
parse_media_format now derives is_original / is_default from the
format_note markers, consistent with is_60fps / is_hdr. Lets the format
matchers stop doing raw substring checks on format_note.
Refs #1468
A per-Source CharField choice (original / default) with a data migration.
Defaults to 'original', which keeps the current combined-format matching
behaviour (added in PR #1452) unchanged. format_summary gains a
' DEFAULT-AUDIO' marker so the source list shows which sources deviate.
Refs #1468
For an upcoming per-Source setting that picks between the original audio
track and the publisher's default track (often an auto-generated dub)
when a video exposes more than one.