From d65d29efa3e3e8fb0f2eafc4e1cf0fc698af5436 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 17 Feb 2024 23:19:07 +0000 Subject: [PATCH] Remove unnecessary LANGUAGE_MUX_MAP This language tag/code mapping table is no longer needed as of MKVToolNix v67, which has been the minimum supported version for some time now already. --- devine/core/constants.py | 12 ------------ devine/core/tracks/tracks.py | 14 ++++---------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/devine/core/constants.py b/devine/core/constants.py index 447351c..13adfff 100644 --- a/devine/core/constants.py +++ b/devine/core/constants.py @@ -5,18 +5,6 @@ DOWNLOAD_CANCELLED = Event() DOWNLOAD_LICENCE_ONLY = Event() DRM_SORT_MAP = ["ClearKey", "Widevine"] -LANGUAGE_MUX_MAP = { - # List of language tags that cannot be used by mkvmerge and need replacements. - # Try get the replacement to be as specific locale-wise as possible. - # A bcp47 as the replacement is recommended. - "cmn": "zh", - "cmn-Hant": "zh-Hant", - "cmn-Hans": "zh-Hans", - "none": "und", - "yue": "zh-yue", - "yue-Hant": "zh-yue-Hant", - "yue-Hans": "zh-yue-Hans" -} TERRITORY_MAP = { "Hong Kong SAR China": "Hong Kong" } diff --git a/devine/core/tracks/tracks.py b/devine/core/tracks/tracks.py index d96804c..108dcf7 100644 --- a/devine/core/tracks/tracks.py +++ b/devine/core/tracks/tracks.py @@ -13,7 +13,7 @@ from rich.tree import Tree from devine.core.config import config from devine.core.console import console -from devine.core.constants import LANGUAGE_MAX_DISTANCE, LANGUAGE_MUX_MAP, AnyTrack, TrackT +from devine.core.constants import LANGUAGE_MAX_DISTANCE, AnyTrack, TrackT from devine.core.tracks.audio import Audio from devine.core.tracks.chapters import Chapter, Chapters from devine.core.tracks.subtitle import Subtitle @@ -306,9 +306,7 @@ class Tracks: if callable(vt.OnMultiplex): vt.OnMultiplex() cl.extend([ - "--language", "0:{}".format(LANGUAGE_MUX_MAP.get( - str(vt.language), str(vt.language) - )), + "--language", f"0:{vt.language}", "--default-track", f"0:{i == 0}", "--original-flag", f"0:{vt.is_original_lang}", "--compression", "0:none", # disable extra compression @@ -322,9 +320,7 @@ class Tracks: at.OnMultiplex() cl.extend([ "--track-name", f"0:{at.get_track_name() or ''}", - "--language", "0:{}".format(LANGUAGE_MUX_MAP.get( - str(at.language), str(at.language) - )), + "--language", f"0:{at.language}", "--default-track", f"0:{i == 0}", "--visual-impaired-flag", f"0:{at.descriptive}", "--original-flag", f"0:{at.is_original_lang}", @@ -340,9 +336,7 @@ class Tracks: default = bool(self.audio and is_close_match(st.language, [self.audio[0].language]) and st.forced) cl.extend([ "--track-name", f"0:{st.get_track_name() or ''}", - "--language", "0:{}".format(LANGUAGE_MUX_MAP.get( - str(st.language), str(st.language) - )), + "--language", f"0:{st.language}", "--sub-charset", "0:UTF-8", "--forced-track", f"0:{st.forced}", "--default-track", f"0:{default}",