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 pathlib import Path
from typing import Callable, Tuple from typing import Tuple
import re
from mutagen.mp3 import MP3 from mutagen.mp3 import MP3
from utils.console import print_step, print_substep
from rich.progress import track from rich.progress import track
from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips from moviepy.editor import AudioFileClip, CompositeAudioClip, concatenate_audioclips
import re from utils.console import print_step, print_substep
class TTSEngine: class TTSEngine:

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

Loading…
Cancel
Save