From ce6dcb44ea10c55aa52c2d3aec2e5a7c65044062 Mon Sep 17 00:00:00 2001 From: Ali Hamdi Ali Fadel Date: Mon, 21 Aug 2023 23:30:20 +0300 Subject: [PATCH] Filter wit.ai API keys before saving them to the Config object --- tafrigh/config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tafrigh/config.py b/tafrigh/config.py index 7a931ea..82c578a 100644 --- a/tafrigh/config.py +++ b/tafrigh/config.py @@ -50,7 +50,7 @@ def __init__( ) def use_wit(self) -> bool: - return self.wit.wit_client_access_tokens != [] + return self.wit.wit_client_access_tokens is not None and self.wit.wit_client_access_tokens != [] class Input: def __init__(self, urls_or_paths: list[str], skip_if_output_exist: bool, playlist_items: str, verbose: bool): @@ -84,7 +84,13 @@ def __init__( class Wit: def __init__(self, wit_client_access_tokens: list[str], max_cutting_duration: int): - self.wit_client_access_tokens = wit_client_access_tokens + if wit_client_access_tokens is None: + self.wit_client_access_tokens = None + else: + self.wit_client_access_tokens = [ + key for key in wit_client_access_tokens if key is not None and key != '' + ] + self.max_cutting_duration = max_cutting_duration class Output: