From 32e4ec0682f3fbc5d5ee7b580d3558cbe9ccbddb Mon Sep 17 00:00:00 2001 From: misyaguziya <53165965+misyaguziya@users.noreply.github.com> Date: Sat, 31 May 2025 04:09:28 +0900 Subject: [PATCH] [Bugfix] Controller: Fixed degradation that occurred with commit hash: d940097. --- src-python/controller.py | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src-python/controller.py b/src-python/controller.py index 080df101..89a07d3a 100644 --- a/src-python/controller.py +++ b/src-python/controller.py @@ -1985,7 +1985,41 @@ class Controller: printLog("Init Translation Engine Status") for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST: - config.SELECTABLE_TRANSCRIPTION_ENGINE_STATUS[engine] = False + match engine: + case "CTranslate2": + if model.checkTranslatorCTranslate2ModelWeight(config.CTRANSLATE2_WEIGHT_TYPE) is True: + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = True + else: + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = False + case "DeepL_API": + printLog("Start check DeepL API Key") + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = False + if config.AUTH_KEYS[engine] is not None: + if model.authenticationTranslatorDeepLAuthKey(auth_key=config.AUTH_KEYS[engine]) is True: + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = True + else: + # error update Auth key + auth_keys = config.AUTH_KEYS + auth_keys[engine] = None + config.AUTH_KEYS = auth_keys + case _: + if connected_network is True: + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = True + else: + config.SELECTABLE_TRANSLATION_ENGINE_STATUS[engine] = False + + for engine in config.SELECTABLE_TRANSCRIPTION_ENGINE_LIST: + match engine: + case "Whisper": + if model.checkTranscriptionWhisperModelWeight(config.WHISPER_WEIGHT_TYPE) is True: + config.SELECTABLE_TRANSCRIPTION_ENGINE_STATUS[engine] = True + else: + config.SELECTABLE_TRANSCRIPTION_ENGINE_STATUS[engine] = False + case _: + if connected_network is True: + config.SELECTABLE_TRANSCRIPTION_ENGINE_STATUS[engine] = True + else: + config.SELECTABLE_TRANSCRIPTION_ENGINE_STATUS[engine] = False self.initializationProgress(2) # set Translation Engine