Compare commits

...

2 Commits

Author SHA1 Message Date
dd43acb829
Suppose la langue depuis le nom de fichier 2021-12-27 15:30:19 +01:00
9257c16287 typo 2021-12-27 15:17:18 +01:00

View File

@ -142,7 +142,7 @@ def stabilization(file):
def extract_subs(file, track, lang):
command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -map_metadata -1 -vn -an -c:s copy -metadata language="{lang}" -y {file}_subtitle_{track}_{lang}.mkv'
logging.info(f"Extractio du sous-titre {track}, langue : {lang}...")
logging.info(f"Extraction du sous-titre {track}, langue : {lang}...")
logging.debug(command)
result = subprocess.getoutput(command)
if result != "":
@ -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(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:
lang = file[-7:][:-4]
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(f"0:{lang}")
json_data.append("(")
json_data.append(file)
json_data.append(")")