|
|
@ -2,7 +2,6 @@
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
from typing import Tuple
|
|
|
|
from typing import Tuple
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
from os import getenv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# import sox
|
|
|
|
# import sox
|
|
|
|
# from mutagen import MutagenError
|
|
|
|
# from mutagen import MutagenError
|
|
|
@ -12,6 +11,7 @@ from rich.progress import track
|
|
|
|
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
|
|
|
|
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
from utils.voice import sanitize_text
|
|
|
|
from utils.voice import sanitize_text
|
|
|
|
|
|
|
|
from utils import settings
|
|
|
|
|
|
|
|
|
|
|
|
DEFUALT_MAX_LENGTH: int = 50 # video length variable
|
|
|
|
DEFUALT_MAX_LENGTH: int = 50 # video length variable
|
|
|
|
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ class TTSEngine:
|
|
|
|
print_step("Saving Text to MP3 files...")
|
|
|
|
print_step("Saving Text to MP3 files...")
|
|
|
|
|
|
|
|
|
|
|
|
self.call_tts("title", self.reddit_object["thread_title"])
|
|
|
|
self.call_tts("title", self.reddit_object["thread_title"])
|
|
|
|
if self.reddit_object["thread_post"] != "" and getenv("STORYMODE", "").casefold() == "true":
|
|
|
|
if self.reddit_object["thread_post"] != "" and settings.config["settings"]["storymode"] == True:
|
|
|
|
self.call_tts("posttext", self.reddit_object["thread_post"])
|
|
|
|
self.call_tts("posttext", self.reddit_object["thread_post"])
|
|
|
|
|
|
|
|
|
|
|
|
idx = None
|
|
|
|
idx = None
|
|
|
@ -109,7 +109,7 @@ class TTSEngine:
|
|
|
|
clip.close()
|
|
|
|
clip.close()
|
|
|
|
|
|
|
|
|
|
|
|
def process_text(text: str):
|
|
|
|
def process_text(text: str):
|
|
|
|
lang = getenv("POSTLANG", "")
|
|
|
|
lang = settings.config["reddit"]["thread"]["post_lang"]
|
|
|
|
new_text = sanitize_text(text)
|
|
|
|
new_text = sanitize_text(text)
|
|
|
|
if lang:
|
|
|
|
if lang:
|
|
|
|
print_substep("Translating Text...")
|
|
|
|
print_substep("Translating Text...")
|
|
|
|