Skip to content

Commit

Permalink
Filter wit.ai API keys before saving them to the Config object
Browse files Browse the repository at this point in the history
  • Loading branch information
AliOsm committed Aug 21, 2023
1 parent 6ff7fa8 commit ce6dcb4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tafrigh/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit ce6dcb4

Please sign in to comment.