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
+2
View File
@@ -126,6 +126,7 @@ class Config:
self.redact_paths: bool = kwargs.get("redact_paths", True)
self.language_tags: dict = kwargs.get("language_tags") or {}
self.dual_multi_mode: str = (kwargs.get("dual_multi_mode") or "strict").lower()
self.output_template: dict = kwargs.get("output_template") or {}
folder_cfg = self.output_template.pop("folder", "")
self.folder_template: str = ""
@@ -191,6 +192,7 @@ class Config:
"atmos",
"dual",
"multi",
"dubbed",
"video",
"hdr",
"hfr",
+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:
+9 -8
View File
@@ -9,18 +9,19 @@
# Group or username appended to download filenames after a dash.
tag: "NOGRP"
# --- Output filename & folder templates --- docs/OUTPUT_CONFIG.md
# Full variable list (35 vars incl. music) and all naming options are
# documented in docs/OUTPUT_CONFIG.md. If omitted, scene-style defaults are
# used (with a warning). Conditional variables take a ? suffix, e.g. {year?}.
# --- Output filename & folder templates --- docs/guide/output-and-naming.md
# The full variable list and all naming options are documented there.
# movies/series have no built-in fallback (define them to download those kinds);
# songs falls back to "{track_number}. {title}". Conditional variables take a
# ? suffix, e.g. {year?}.
output_template:
# Scene-style naming (dot-separated)
movies: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
series: "{title}.{year?}.{season_episode}.{episode_name?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
movies: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{dubbed?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
series: "{title}.{year?}.{season_episode}.{episode_name?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{dubbed?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
songs: "{track_number}.{title}.{repack?}.{edition?}.{lang_tag?}.{source?}.WEB-DL.{audio_full}.{atmos?}-{tag}"
folder:
movies: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
series: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
movies: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{dubbed?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
series: "{title}.{year?}.{repack?}.{edition?}.{lang_tag?}.{quality}.{source}.WEB-DL.{dual?}.{multi?}.{dubbed?}.{audio_full}.{atmos?}.{hdr?}.{hfr?}.{video}-{tag}"
albums: "{album_artist} - {album} ({year?})"
#