Merge branch 'model' into for_webui
This commit is contained in:
@@ -157,24 +157,19 @@ def startTranscriptionSendMessage(action:Callable[[dict], None]) -> None:
|
|||||||
mic_message = MicMessage(action)
|
mic_message = MicMessage(action)
|
||||||
model.startMicTranscript(mic_message.send)
|
model.startMicTranscript(mic_message.send)
|
||||||
|
|
||||||
def stopTranscriptionSendMessage(action:Callable[[dict], None]) -> None:
|
def stopTranscriptionSendMessage() -> None:
|
||||||
model.stopMicTranscript()
|
model.stopMicTranscript()
|
||||||
action("mic", {
|
|
||||||
"status":200,
|
|
||||||
"result":{
|
|
||||||
"message":"Stopped sending messages"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
def startThreadingTranscriptionSendMessage(action:Callable[[dict], None]) -> None:
|
def startThreadingTranscriptionSendMessage(action:Callable[[dict], None]) -> None:
|
||||||
th_startTranscriptionSendMessage = Thread(target=startTranscriptionSendMessage, args=(action,))
|
th_startTranscriptionSendMessage = Thread(target=startTranscriptionSendMessage, args=(action,))
|
||||||
th_startTranscriptionSendMessage.daemon = True
|
th_startTranscriptionSendMessage.daemon = True
|
||||||
th_startTranscriptionSendMessage.start()
|
th_startTranscriptionSendMessage.start()
|
||||||
|
|
||||||
def stopThreadingTranscriptionSendMessage(action:Callable[[dict], None]) -> None:
|
def stopThreadingTranscriptionSendMessage() -> None:
|
||||||
th_stopTranscriptionSendMessage = Thread(target=stopTranscriptionSendMessage, args=(action,))
|
th_stopTranscriptionSendMessage = Thread(target=stopTranscriptionSendMessage)
|
||||||
th_stopTranscriptionSendMessage.daemon = True
|
th_stopTranscriptionSendMessage.daemon = True
|
||||||
th_stopTranscriptionSendMessage.start()
|
th_stopTranscriptionSendMessage.start()
|
||||||
|
th_stopTranscriptionSendMessage.join()
|
||||||
|
|
||||||
def startTranscriptionSendMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
|
def startTranscriptionSendMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
|
||||||
mic_message = MicMessage(action)
|
mic_message = MicMessage(action)
|
||||||
@@ -256,24 +251,19 @@ def startTranscriptionReceiveMessage(action:Callable[[dict], None]) -> None:
|
|||||||
speaker_message = SpeakerMessage(action)
|
speaker_message = SpeakerMessage(action)
|
||||||
model.startSpeakerTranscript(speaker_message.receive)
|
model.startSpeakerTranscript(speaker_message.receive)
|
||||||
|
|
||||||
def stopTranscriptionReceiveMessage(action:Callable[[dict], None]) -> None:
|
def stopTranscriptionReceiveMessage() -> None:
|
||||||
model.stopSpeakerTranscript()
|
model.stopSpeakerTranscript()
|
||||||
action("speaker", {
|
|
||||||
"status":200,
|
|
||||||
"result": {
|
|
||||||
"message":"Stopped receiving messages"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
def startThreadingTranscriptionReceiveMessage(action:Callable[[dict], None]) -> None:
|
def startThreadingTranscriptionReceiveMessage(action:Callable[[dict], None]) -> None:
|
||||||
th_startTranscriptionReceiveMessage = Thread(target=startTranscriptionReceiveMessage, args=(action,))
|
th_startTranscriptionReceiveMessage = Thread(target=startTranscriptionReceiveMessage, args=(action,))
|
||||||
th_startTranscriptionReceiveMessage.daemon = True
|
th_startTranscriptionReceiveMessage.daemon = True
|
||||||
th_startTranscriptionReceiveMessage.start()
|
th_startTranscriptionReceiveMessage.start()
|
||||||
|
|
||||||
def stopThreadingTranscriptionReceiveMessage(action:Callable[[dict], None]) -> None:
|
def stopThreadingTranscriptionReceiveMessage() -> None:
|
||||||
th_stopTranscriptionReceiveMessage = Thread(target=stopTranscriptionReceiveMessage, args=(action,))
|
th_stopTranscriptionReceiveMessage = Thread(target=stopTranscriptionReceiveMessage)
|
||||||
th_stopTranscriptionReceiveMessage.daemon = True
|
th_stopTranscriptionReceiveMessage.daemon = True
|
||||||
th_stopTranscriptionReceiveMessage.start()
|
th_stopTranscriptionReceiveMessage.start()
|
||||||
|
th_stopTranscriptionReceiveMessage.join()
|
||||||
|
|
||||||
def startTranscriptionReceiveMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
|
def startTranscriptionReceiveMessageOnCloseConfigWindow(action:Callable[[dict], None]) -> None:
|
||||||
speaker_message = SpeakerMessage(action)
|
speaker_message = SpeakerMessage(action)
|
||||||
@@ -364,15 +354,6 @@ def callbackMessageBoxTypingStop(*args, **kwargs) -> dict:
|
|||||||
model.oscStopSendTyping()
|
model.oscStopSendTyping()
|
||||||
return {"status":200}
|
return {"status":200}
|
||||||
|
|
||||||
def messageBoxFocusIn(e):
|
|
||||||
# view.foregroundOffIfForegroundEnabled()
|
|
||||||
pass
|
|
||||||
|
|
||||||
def messageBoxFocusOut(e):
|
|
||||||
# view.foregroundOnIfForegroundEnabled()
|
|
||||||
if config.ENABLE_SEND_MESSAGE_TO_VRC is True:
|
|
||||||
model.oscStopSendTyping()
|
|
||||||
|
|
||||||
# def addSentMessageLog(sent_message):
|
# def addSentMessageLog(sent_message):
|
||||||
# config.SENT_MESSAGES_LOG.append(sent_message)
|
# config.SENT_MESSAGES_LOG.append(sent_message)
|
||||||
# config.CURRENT_SENT_MESSAGES_LOG_INDEX = len(config.SENT_MESSAGES_LOG)
|
# config.CURRENT_SENT_MESSAGES_LOG_INDEX = len(config.SENT_MESSAGES_LOG)
|
||||||
@@ -531,10 +512,10 @@ def callbackEnableTranscriptionSend(data, action, *args, **kwargs) -> dict:
|
|||||||
startThreadingTranscriptionSendMessage(action)
|
startThreadingTranscriptionSendMessage(action)
|
||||||
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_SEND}
|
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_SEND}
|
||||||
|
|
||||||
def callbackDisableTranscriptionSend(data, action, *args, **kwargs) -> dict:
|
def callbackDisableTranscriptionSend(*args, **kwargs) -> dict:
|
||||||
printLog("Disable Transcription Send")
|
printLog("Disable Transcription Send")
|
||||||
config.ENABLE_TRANSCRIPTION_SEND = False
|
config.ENABLE_TRANSCRIPTION_SEND = False
|
||||||
stopThreadingTranscriptionSendMessage(action)
|
stopThreadingTranscriptionSendMessage()
|
||||||
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_SEND}
|
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_SEND}
|
||||||
|
|
||||||
def callbackEnableTranscriptionReceive(data, action, *args, **kwargs) -> dict:
|
def callbackEnableTranscriptionReceive(data, action, *args, **kwargs) -> dict:
|
||||||
@@ -547,10 +528,10 @@ def callbackEnableTranscriptionReceive(data, action, *args, **kwargs) -> dict:
|
|||||||
model.startOverlay()
|
model.startOverlay()
|
||||||
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_RECEIVE}
|
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_RECEIVE}
|
||||||
|
|
||||||
def callbackDisableTranscriptionReceive(data, action, *args, **kwargs) -> dict:
|
def callbackDisableTranscriptionReceive(*args, **kwargs) -> dict:
|
||||||
printLog("Disable Transcription Receive")
|
printLog("Disable Transcription Receive")
|
||||||
config.ENABLE_TRANSCRIPTION_RECEIVE = False
|
config.ENABLE_TRANSCRIPTION_RECEIVE = False
|
||||||
stopThreadingTranscriptionReceiveMessage(action)
|
stopThreadingTranscriptionReceiveMessage()
|
||||||
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_RECEIVE}
|
return {"status":200, "result":config.ENABLE_TRANSCRIPTION_RECEIVE}
|
||||||
|
|
||||||
def callbackEnableForeground(*args, **kwargs) -> dict:
|
def callbackEnableForeground(*args, **kwargs) -> dict:
|
||||||
@@ -770,11 +751,7 @@ def callbackSetMicDevice(data, *args, **kwargs) -> dict:
|
|||||||
printLog("Set Mic Device", data)
|
printLog("Set Mic Device", data)
|
||||||
config.CHOICE_MIC_DEVICE = data
|
config.CHOICE_MIC_DEVICE = data
|
||||||
model.stopCheckMicEnergy()
|
model.stopCheckMicEnergy()
|
||||||
return {"status":200,
|
return {"status":200, "result":config.CHOICE_MIC_DEVICE}
|
||||||
"result":{
|
|
||||||
"host":config.CHOICE_MIC_HOST,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
def callbackSetMicEnergyThreshold(data, *args, **kwargs) -> dict:
|
def callbackSetMicEnergyThreshold(data, *args, **kwargs) -> dict:
|
||||||
printLog("Set Mic Energy Threshold", data)
|
printLog("Set Mic Energy Threshold", data)
|
||||||
|
|||||||
@@ -212,17 +212,11 @@ action_mapping = {
|
|||||||
"error_translation_engine":"/action/error_translation_engine",
|
"error_translation_engine":"/action/error_translation_engine",
|
||||||
"word_filter":"/action/word_filter",
|
"word_filter":"/action/word_filter",
|
||||||
},
|
},
|
||||||
"/controller/callback_disable_transcription_send": {
|
|
||||||
"mic":"/action/transcription_send_mic_message_stopped"
|
|
||||||
},
|
|
||||||
"/controller/callback_enable_transcription_receive": {
|
"/controller/callback_enable_transcription_receive": {
|
||||||
"speaker":"/action/transcription_receive_speaker_message",
|
"speaker":"/action/transcription_receive_speaker_message",
|
||||||
"error_device":"/action/error_device",
|
"error_device":"/action/error_device",
|
||||||
"error_translation_engine":"/action/error_translation_engine",
|
"error_translation_engine":"/action/error_translation_engine",
|
||||||
},
|
},
|
||||||
"/controller/callback_disable_transcription_receive": {
|
|
||||||
"speaker":"/action/transcription_receive_speaker_message_stopped"
|
|
||||||
},
|
|
||||||
"/controller/callback_enable_check_mic_threshold": {
|
"/controller/callback_enable_check_mic_threshold": {
|
||||||
"mic":"/action/check_mic_threshold_energy",
|
"mic":"/action/check_mic_threshold_energy",
|
||||||
"stopped":"/action/check_mic_threshold_energy_stopped",
|
"stopped":"/action/check_mic_threshold_energy_stopped",
|
||||||
|
|||||||
Reference in New Issue
Block a user