Added translation for filename TOML compatible

This commit is contained in:
Tomovic committed 2022-07-06 16:19:36 +02:00
1 parent 869bfd874a
commit cebbbf72cb
1 file changed
+10 -1
+10 -1
View File
@@ -4,6 +4,7 @@ import os
import re
from os.path import exists
from typing import Dict
import translators as ts
from moviepy.editor import (
VideoFileClip,
@@ -35,7 +36,15 @@ def name_normalize(
name = re.sub(r'([0-9]+)\s?\/\s?([0-9]+)', r'\1 of \2', name)
name = re.sub(r'(\w+)\s?\/\s?(\w+)', r'\1 or \2', name)
name = re.sub(r'\/', r'', name)
return name
lang = settings.config["reddit"]["thread"]["post_lang"]
if lang != "":
print_substep("Translating filename...")
translated_name = ts.google(name, to_language = lang)
return translated_name
else:
return name
def make_final_video(