fix(tracks): keep regional language variants distinct in exact selection

by_language now applies RFC 4647 Lookup in exact mode, preferring the string-equal tag so --exact-lang separates base/regional pairs (ar/ar-EG, en/en-US) instead of collapsing them, and dedupes by id to prevent the duplicate-track-id crash. Adds a language-selection regression test.
This commit is contained in:
imSp4rky
2026-07-14 09:17:22 -06:00
parent 1cf9e5b487
commit b8ec9e2498
4 changed files with 149 additions and 14 deletions
+2 -6
View File
@@ -61,9 +61,7 @@ class Title:
returned dict with their specific fields (e.g., season/episode).
"""
primary_video_track = next(iter(media_info.video_tracks), None)
original_lang_tag = (
str(self.language).split("-")[0].lower() if self.language else ""
)
original_lang_tag = str(self.language).split("-")[0].lower() if self.language else ""
primary_audio_track = None
if original_lang_tag:
primary_audio_track = next(
@@ -170,9 +168,7 @@ class Title:
channel_count = primary_audio_track.channel_s or primary_audio_track.channels or 0
channels = float(channel_count)
has_atmos = any(
"JOC" in (t.format_additionalfeatures or "") or t.joc for t in media_info.audio_tracks
)
has_atmos = any("JOC" in (t.format_additionalfeatures or "") or t.joc for t in media_info.audio_tracks)
context.update(
{