From 1ee299d6f017ecc331e5ffa684b8826419be61ec Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 6 Jun 2022 22:42:41 +0100 Subject: [PATCH] Clean up imports and styling --- tts/engine_wrapper.py | 6 +++--- video_creation/voices.py | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tts/engine_wrapper.py b/tts/engine_wrapper.py index e60a093..046713d 100644 --- a/tts/engine_wrapper.py +++ b/tts/engine_wrapper.py @@ -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: diff --git a/video_creation/voices.py b/video_creation/voices.py index b77a60d..667b2bd 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -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