diff --git a/.env.template b/.env.template index fcfc739..d9a7f2f 100644 --- a/.env.template +++ b/.env.template @@ -66,8 +66,17 @@ OPACITY="1" #.8 VOICE="Matthew" #en_us_002 #EXPLANATION sets the voice the TTS uses -TTsChoice="polly" #polly -#EXPLANATION the backend used for TTS, default is polly +TTSCHOICE="" +#EXPLANATION the backend used for TTS. Without anything specified, the user will be prompted to choose one. + +STREAMLABS_VOICE="Joanna" +#EXPLANATION Sets the voice for the Streamlabs Polly TTS Engine. Check the file for more information on different voices. + +AWS_VOICE="Joanna" +#EXPLANATION Sets the voice for the AWS Polly TTS Engine. Check the file for more information on different voices. + +TIKTOK_VOICE="en_us_006" +#EXPLANATION Sets the voice for the TikTok TTS Engine. Check the file for more information on different voices. #OPTIONAL STORYMODE="False" diff --git a/TTS/TikTok.py b/TTS/TikTok.py index ccec427..874e8dd 100644 --- a/TTS/TikTok.py +++ b/TTS/TikTok.py @@ -73,7 +73,7 @@ class TikTok: # TikTok Text-to-Speech Wrapper voice = ( self.randomvoice() if random_voice - else (os.getenv("VOICE") or random.choice(self.voices["human"])) + else (os.getenv("TIKTOK_VOICE") or random.choice(self.voices["human"])) ) try: r = requests.post( diff --git a/TTS/aws_polly.py b/TTS/aws_polly.py index 3bf7090..703aa6a 100644 --- a/TTS/aws_polly.py +++ b/TTS/aws_polly.py @@ -39,7 +39,7 @@ class AWSPolly: return ValueError( f"Please set the environment variable VOICE to a valid voice. options are: {voices}" ) - voice = str(os.getenv("VOICE")).capitalize() + voice = str(os.getenv("AWS_VOICE")).capitalize() try: # Request speech synthesis response = polly.synthesize_speech( diff --git a/TTS/streamlabs_polly.py b/TTS/streamlabs_polly.py index 07f2c17..500cb16 100644 --- a/TTS/streamlabs_polly.py +++ b/TTS/streamlabs_polly.py @@ -39,7 +39,7 @@ class StreamlabsPolly: return ValueError( f"Please set the environment variable VOICE to a valid voice. options are: {voices}" ) - voice = str(os.getenv("VOICE")).capitalize() + voice = str(os.getenv("STREAMLABS_VOICE")).capitalize() body = {"voice": voice, "text": text, "service": "polly"} response = requests.post(self.url, data=body) try: diff --git a/video_creation/voices.py b/video_creation/voices.py index 9407d59..bbc755e 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -29,9 +29,11 @@ def save_text_to_mp3(reddit_obj): Args: 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: - text_to_mp3 = TTSEngine(env, reddit_obj) + env = os.getenv("TTSCHOICE", "") + if env.casefold in map(lambda _: _.casefold(), TTSProviders): + text_to_mp3 = TTSEngine( + get_case_insensitive_key_value(TTSProviders, env), reddit_obj + ) else: chosen = False choice = ""