Merge pull request from tomovicj/CordlessCoder-TOML

Added translation for filename TOML compatible
pull/879/head
Callum Leslie 3 years ago committed by GitHub
commit 47982db30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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,
@ -34,6 +35,14 @@ def name_normalize(name: str) -> str:
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)
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

Loading…
Cancel
Save