Merge branch 'ruff' into installer
# Conflicts: # model.py
This commit is contained in:
27
model.py
27
model.py
@@ -83,9 +83,9 @@ class Model:
|
||||
self.keyword_processor = KeywordProcessor()
|
||||
|
||||
def authenticationTranslator(self, choice_translator=None, auth_key=None):
|
||||
if choice_translator == None:
|
||||
if choice_translator is None:
|
||||
choice_translator = config.CHOICE_TRANSLATOR
|
||||
if auth_key == None:
|
||||
if auth_key is None:
|
||||
auth_key = config.AUTH_KEYS[choice_translator]
|
||||
|
||||
result = self.translator.authentication(choice_translator, auth_key)
|
||||
@@ -131,10 +131,10 @@ class Model:
|
||||
compatible_engines.append(engine)
|
||||
engine_name = compatible_engines[0]
|
||||
|
||||
if engine_name == "DeepL" and config.AUTH_KEYS["DeepL_API"] != None:
|
||||
if engine_name == "DeepL" and config.AUTH_KEYS["DeepL_API"] is not None:
|
||||
if self.authenticationTranslator(engine_name, config.AUTH_KEYS["DeepL_API"]) is True:
|
||||
engine_name = "DeepL_API"
|
||||
elif engine_name == "DeepL_API" and config.AUTH_KEYS["DeepL_API"] == None:
|
||||
elif engine_name == "DeepL_API" and config.AUTH_KEYS["DeepL_API"] is None:
|
||||
engine_name = "DeepL"
|
||||
|
||||
return engine_name
|
||||
@@ -289,8 +289,7 @@ class Model:
|
||||
move(os_path.join(current_directory, folder_name, "batch", batch_name), os_path.join(current_directory, batch_name))
|
||||
command = [os_path.join(current_directory, batch_name), program_name, folder_name, tmp_directory_name, str(restart)]
|
||||
Popen(command, cwd=current_directory)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except Exception:
|
||||
webbrowser.open(config.BOOTH_URL, new=2, autoraise=True)
|
||||
|
||||
@staticmethod
|
||||
@@ -323,7 +322,7 @@ class Model:
|
||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
@@ -352,7 +351,7 @@ class Model:
|
||||
message = mic_transcriber.getTranscript()
|
||||
try:
|
||||
fnc(message)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.mic_print_transcript = threadFnc(sendMicTranscript)
|
||||
@@ -371,7 +370,7 @@ class Model:
|
||||
if config.CHOICE_MIC_HOST == "NoHost" or config.CHOICE_MIC_DEVICE == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
@@ -380,7 +379,7 @@ class Model:
|
||||
energy = mic_energy_queue.get()
|
||||
try:
|
||||
fnc(energy)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
sleep(0.01)
|
||||
|
||||
@@ -405,7 +404,7 @@ class Model:
|
||||
if speaker_device["name"] == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
@@ -433,7 +432,7 @@ class Model:
|
||||
message = speaker_transcriber.getTranscript()
|
||||
try:
|
||||
fnc(message)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
self.speaker_print_transcript = threadFnc(sendSpeakerTranscript)
|
||||
@@ -453,7 +452,7 @@ class Model:
|
||||
if speaker_device["name"] == "NoDevice":
|
||||
try:
|
||||
error_fnc()
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return
|
||||
|
||||
@@ -462,7 +461,7 @@ class Model:
|
||||
energy = speaker_energy_queue.get()
|
||||
try:
|
||||
fnc(energy)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
sleep(0.01)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user