🐛[bugfix] controller: offline時の処理でエラーになる問題を修正
This commit is contained in:
@@ -29,12 +29,14 @@ class Controller:
|
|||||||
self.run(
|
self.run(
|
||||||
200,
|
200,
|
||||||
self.run_mapping["connected_network"],
|
self.run_mapping["connected_network"],
|
||||||
|
True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def disconnectedNetwork(self) -> None:
|
def disconnectedNetwork(self) -> None:
|
||||||
self.run(
|
self.run(
|
||||||
200,
|
200,
|
||||||
self.run_mapping["disconnected_network"],
|
self.run_mapping["connected_network"],
|
||||||
|
False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def updateMicHostList(self) -> None:
|
def updateMicHostList(self) -> None:
|
||||||
@@ -526,7 +528,10 @@ class Controller:
|
|||||||
your_language = config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]
|
your_language = config.SELECTED_YOUR_LANGUAGES[config.SELECTED_TAB_NO]["1"]
|
||||||
for target_language in config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO].values():
|
for target_language in config.SELECTED_TARGET_LANGUAGES[config.SELECTED_TAB_NO].values():
|
||||||
if your_language["language"] == target_language["language"] and target_language["enable"] is True:
|
if your_language["language"] == target_language["language"] and target_language["enable"] is True:
|
||||||
engines = ["CTranslate2"]
|
if config.SELECTABLE_TRANSLATION_ENGINE_STATUS["CTranslate2"] is True:
|
||||||
|
engines = ["CTranslate2"]
|
||||||
|
else:
|
||||||
|
engines = []
|
||||||
|
|
||||||
return {"status":200, "result":engines}
|
return {"status":200, "result":engines}
|
||||||
|
|
||||||
@@ -1707,6 +1712,7 @@ class Controller:
|
|||||||
self.connectedNetwork()
|
self.connectedNetwork()
|
||||||
else:
|
else:
|
||||||
self.disconnectedNetwork()
|
self.disconnectedNetwork()
|
||||||
|
printLog(f"Connected Network: {connected_network}")
|
||||||
|
|
||||||
printLog("Init Translation Engine Status")
|
printLog("Init Translation Engine Status")
|
||||||
for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST:
|
for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST:
|
||||||
@@ -1724,28 +1730,29 @@ class Controller:
|
|||||||
config.AUTH_KEYS = auth_keys
|
config.AUTH_KEYS = auth_keys
|
||||||
self.initializationProgress(1)
|
self.initializationProgress(1)
|
||||||
|
|
||||||
# download CTranslate2 Model Weight
|
if connected_network is True:
|
||||||
printLog("Download CTranslate2 Model Weight")
|
# download CTranslate2 Model Weight
|
||||||
weight_type = config.CTRANSLATE2_WEIGHT_TYPE
|
printLog("Download CTranslate2 Model Weight")
|
||||||
th_download_ctranslate2 = None
|
weight_type = config.CTRANSLATE2_WEIGHT_TYPE
|
||||||
if model.checkTranslatorCTranslate2ModelWeight(weight_type) is False:
|
th_download_ctranslate2 = None
|
||||||
th_download_ctranslate2 = Thread(target=self.downloadCtranslate2Weight, args=(weight_type, False))
|
if model.checkTranslatorCTranslate2ModelWeight(weight_type) is False:
|
||||||
th_download_ctranslate2.daemon = True
|
th_download_ctranslate2 = Thread(target=self.downloadCtranslate2Weight, args=(weight_type, False))
|
||||||
th_download_ctranslate2.start()
|
th_download_ctranslate2.daemon = True
|
||||||
|
th_download_ctranslate2.start()
|
||||||
|
|
||||||
# download Whisper Model Weight
|
# download Whisper Model Weight
|
||||||
printLog("Download Whisper Model Weight")
|
printLog("Download Whisper Model Weight")
|
||||||
weight_type = config.WHISPER_WEIGHT_TYPE
|
weight_type = config.WHISPER_WEIGHT_TYPE
|
||||||
th_download_whisper = None
|
th_download_whisper = None
|
||||||
if model.checkTranscriptionWhisperModelWeight(weight_type) is False:
|
if model.checkTranscriptionWhisperModelWeight(weight_type) is False:
|
||||||
th_download_whisper = Thread(target=self.downloadWhisperWeight, args=(weight_type, False))
|
th_download_whisper = Thread(target=self.downloadWhisperWeight, args=(weight_type, False))
|
||||||
th_download_whisper.daemon = True
|
th_download_whisper.daemon = True
|
||||||
th_download_whisper.start()
|
th_download_whisper.start()
|
||||||
|
|
||||||
if isinstance(th_download_ctranslate2, Thread):
|
if isinstance(th_download_ctranslate2, Thread):
|
||||||
th_download_ctranslate2.join()
|
th_download_ctranslate2.join()
|
||||||
if isinstance(th_download_whisper, Thread):
|
if isinstance(th_download_whisper, Thread):
|
||||||
th_download_whisper.join()
|
th_download_whisper.join()
|
||||||
|
|
||||||
for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST:
|
for engine in config.SELECTABLE_TRANSLATION_ENGINE_LIST:
|
||||||
match engine:
|
match engine:
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from utils import printLog, printResponse, errorLogging, encodeBase64
|
|||||||
|
|
||||||
run_mapping = {
|
run_mapping = {
|
||||||
"connected_network":"/run/connected_network",
|
"connected_network":"/run/connected_network",
|
||||||
"disconnected_network":"/run/disconnected_network",
|
|
||||||
|
|
||||||
"transcription_mic":"/run/transcription_send_mic_message",
|
"transcription_mic":"/run/transcription_send_mic_message",
|
||||||
"transcription_speaker":"/run/transcription_receive_speaker_message",
|
"transcription_speaker":"/run/transcription_receive_speaker_message",
|
||||||
|
|||||||
Reference in New Issue
Block a user