Clean up imports and styling

pull/432/head
Callum Leslie 3 years ago
parent ed90809df0
commit 1ee299d6f0

@ -1,10 +1,10 @@
from pathlib import Path
from typing import Callable, Tuple
from typing import Tuple
import re
from mutagen.mp3 import MP3
from utils.console import print_step, print_substep
from rich.progress import track
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
import re
from utils.console import print_step, print_substep
class TTSEngine:

@ -1,7 +1,6 @@
#!/usr/bin/env python3
import os
from utils.console import print_step, print_substep
from rich.progress import track
from tts.engine_wrapper import TTSEngine
import tts.google_translate_tts
@ -17,16 +16,16 @@ def save_text_to_mp3(reddit_obj):
reddit_obj : The reddit object you received from the reddit API in the askreddit.py file.
"""
env = os.getenv("TTS_PROVIDER","")
if env in TTSProviders.keys(): text_to_mp3 = TTSEngine(env, reddit_obj)
if env in TTSProviders: text_to_mp3 = TTSEngine(env, reddit_obj)
else:
chosen = False
choice = ""
while not chosen:
print("Please choose one of the following TTS providers: ")
for i in TTSProviders.keys():
for i in TTSProviders:
print(i)
choice = input("\n")
if choice.casefold() not in map(lambda _: _.casefold(), TTSProviders.keys()):
if choice.casefold() not in map(lambda _: _.casefold(), TTSProviders):
print("Unknown Choice")
else:
chosen = True

Loading…
Cancel
Save