From dd43acb82900c2cf4fb9aa269e87e76a88e9d97e Mon Sep 17 00:00:00 2001 From: Antoine Van Elstraete Date: Mon, 27 Dec 2021 15:30:19 +0100 Subject: [PATCH] Suppose la langue depuis le nom de fichier --- vid_convert.py | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/vid_convert.py b/vid_convert.py index bec9ef0..7ad4056 100755 --- a/vid_convert.py +++ b/vid_convert.py @@ -227,27 +227,12 @@ def create_mkv(filename): json_data.append(")") for file in listdir(): if f"{filename}_audio" in file: + lang = file[-7:][:-4] json_data.append("--no-track-tags") json_data.append("--no-global-tags") json_data.append("--no-chapters") - if "fra" in file: - json_data.append("--language") - json_data.append("0:fr") - elif "eng" in file: - json_data.append("--language") - json_data.append("0:en") - elif "deu" in file: - json_data.append("--language") - json_data.append("0:de") - elif "nld" in file: - json_data.append("--language") - json_data.append("0:nl") - elif "spa" in file: - json_data.append("--language") - json_data.append("0:es") - elif "ita" in file: - json_data.append("--language") - json_data.append("0:it") + json_data.append("--language") + json_data.append(f"0:{lang}") json_data.append("(") json_data.append(file) json_data.append(")") @@ -256,24 +241,9 @@ def create_mkv(filename): json_data.append("--no-track-tags") json_data.append("--no-global-tags") json_data.append("--no-chapters") - if "fra" in file: - json_data.append("--language") - json_data.append("0:fr") - elif "eng" in file: - json_data.append("--language") - json_data.append("0:en") - elif "deu" in file: - json_data.append("--language") - json_data.append("0:de") - elif "nld" in file: - json_data.append("--language") - json_data.append("0:nl") - elif "spa" in file: - json_data.append("--language") - json_data.append("0:es") - elif "ita" in file: - json_data.append("--language") - json_data.append("0:it") + lang = file[-7:][:-4] + json_data.append("--language") + json_data.append(f"0:{lang}") json_data.append("(") json_data.append(file) json_data.append(")")