feat: original-language aware DUAL/MULTi tagging and new DUBBED variable

DUAL now requires the original language plus one dub (strict default);
dual_multi_mode: count restores the old pure-count behavior.
This commit is contained in:
imSp4rky
2026-07-18 11:02:02 -06:00
parent 094c598ef5
commit 2c8a98f337
6 changed files with 288 additions and 23 deletions
+11 -9
View File
@@ -74,7 +74,8 @@ class Title:
)
if primary_audio_track is None:
primary_audio_track = next(iter(media_info.audio_tracks), None)
unique_audio_languages = len({x.language.split("-")[0] for x in media_info.audio_tracks if x.language})
audio_lang_bases = {x.language.split("-")[0].lower() for x in media_info.audio_tracks if x.language}
unique_audio_languages = len(audio_lang_bases)
context: dict[str, Any] = {
"source": self.service.__name__ if show_service else "",
@@ -88,6 +89,7 @@ class Title:
"atmos": "",
"dual": "",
"multi": "",
"dubbed": "",
"video": "",
"hdr": "",
"hfr": "",
@@ -179,15 +181,15 @@ class Title:
}
)
if unique_audio_languages == 2:
context["dual"] = "DUAL"
context["multi"] = ""
elif unique_audio_languages > 2:
context["dual"] = ""
strict = config.dual_multi_mode != "count"
if unique_audio_languages > 2:
context["multi"] = "MULTi"
else:
context["dual"] = ""
context["multi"] = ""
elif unique_audio_languages == 2:
if not strict or (original_lang_tag and original_lang_tag in audio_lang_bases):
context["dual"] = "DUAL"
elif unique_audio_languages == 1 and strict:
if original_lang_tag and original_lang_tag not in audio_lang_bases:
context["dubbed"] = "DUBBED"
lang_tag_rules = config.language_tags.get("rules") if config.language_tags else None
if lang_tag_rules and self.tracks: