From 3d2004f4cc4d3a91875452252e45dc6f68fbeca6 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Wed, 22 Jun 2022 15:10:38 +0100 Subject: [PATCH] Missing function call on casefold --- video_creation/voices.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/video_creation/voices.py b/video_creation/voices.py index 288db4d..3bbd16c 100644 --- a/video_creation/voices.py +++ b/video_creation/voices.py @@ -31,8 +31,10 @@ 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("TTSCHOICE", "") - if env.casefold in map(lambda _: _.casefold(), TTSProviders): - text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, env), reddit_obj) + if env.casefold() in map(lambda _: _.casefold(), TTSProviders): + text_to_mp3 = TTSEngine( + get_case_insensitive_key_value(TTSProviders, env), reddit_obj + ) else: choice = "" while True: @@ -42,13 +44,19 @@ def save_text_to_mp3(reddit_obj): if choice.casefold() in map(lambda _: _.casefold(), TTSProviders): break print("Unknown Choice") - text_to_mp3 = TTSEngine(get_case_insensitive_key_value(TTSProviders, choice), reddit_obj) + text_to_mp3 = TTSEngine( + get_case_insensitive_key_value(TTSProviders, choice), reddit_obj + ) return text_to_mp3.run() def get_case_insensitive_key_value(input_dict, key): return next( - (value for dict_key, value in input_dict.items() if dict_key.lower() == key.lower()), + ( + value + for dict_key, value in input_dict.items() + if dict_key.lower() == key.lower() + ), None, )