|
|
|
@ -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
|
|
|
|
|