👍️[Update] Controller : 文字起こし処理のデバイス自動設定機能に対応
This commit is contained in:
@@ -170,6 +170,15 @@ class Config:
|
|||||||
if isinstance(value, bool):
|
if isinstance(value, bool):
|
||||||
self._ENABLE_CHECK_ENERGY_RECEIVE = value
|
self._ENABLE_CHECK_ENERGY_RECEIVE = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def IS_OPENED_CONFIG_WINDOW(self):
|
||||||
|
return self._IS_OPENED_CONFIG_WINDOW
|
||||||
|
|
||||||
|
@IS_OPENED_CONFIG_WINDOW.setter
|
||||||
|
def IS_OPENED_CONFIG_WINDOW(self, value):
|
||||||
|
if isinstance(value, bool):
|
||||||
|
self._IS_OPENED_CONFIG_WINDOW = value
|
||||||
|
|
||||||
# @property
|
# @property
|
||||||
# def SENT_MESSAGES_LOG(self):
|
# def SENT_MESSAGES_LOG(self):
|
||||||
# return self._SENT_MESSAGES_LOG
|
# return self._SENT_MESSAGES_LOG
|
||||||
@@ -1000,6 +1009,7 @@ class Config:
|
|||||||
self._ENABLE_FOREGROUND = False
|
self._ENABLE_FOREGROUND = False
|
||||||
self._ENABLE_CHECK_ENERGY_SEND = False
|
self._ENABLE_CHECK_ENERGY_SEND = False
|
||||||
self._ENABLE_CHECK_ENERGY_RECEIVE = False
|
self._ENABLE_CHECK_ENERGY_RECEIVE = False
|
||||||
|
self._IS_OPENED_CONFIG_WINDOW = False
|
||||||
|
|
||||||
# self._SENT_MESSAGES_LOG = []
|
# self._SENT_MESSAGES_LOG = []
|
||||||
# self._CURRENT_SENT_MESSAGES_LOG_INDEX = 0
|
# self._CURRENT_SENT_MESSAGES_LOG_INDEX = 0
|
||||||
|
|||||||
@@ -58,6 +58,14 @@ class Controller:
|
|||||||
def updateSelectedMicDevice(self, host, device) -> None:
|
def updateSelectedMicDevice(self, host, device) -> None:
|
||||||
config.SELECTED_MIC_HOST = host
|
config.SELECTED_MIC_HOST = host
|
||||||
config.SELECTED_MIC_DEVICE = device
|
config.SELECTED_MIC_DEVICE = device
|
||||||
|
if config.IS_OPENED_CONFIG_WINDOW is False:
|
||||||
|
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
|
model.stopMicTranscript()
|
||||||
|
model.startMicTranscript()
|
||||||
|
else:
|
||||||
|
if config.ENABLE_CHECK_ENERGY_SEND is True:
|
||||||
|
model.stopCheckMicEnergy()
|
||||||
|
model.startCheckMicEnergy
|
||||||
self.run(
|
self.run(
|
||||||
200,
|
200,
|
||||||
self.run_mapping["selected_mic_device"],
|
self.run_mapping["selected_mic_device"],
|
||||||
@@ -66,6 +74,14 @@ class Controller:
|
|||||||
|
|
||||||
def updateSelectedSpeakerDevice(self, device) -> None:
|
def updateSelectedSpeakerDevice(self, device) -> None:
|
||||||
config.SELECTED_SPEAKER_DEVICE = device
|
config.SELECTED_SPEAKER_DEVICE = device
|
||||||
|
if config.IS_OPENED_CONFIG_WINDOW is False:
|
||||||
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
|
model.stopSpeakerTranscript()
|
||||||
|
model.startSpeakerTranscript()
|
||||||
|
else:
|
||||||
|
if config.ENABLE_CHECK_ENERGY_RECEIVE is True:
|
||||||
|
model.stopCheckSpeakerEnergy()
|
||||||
|
model.startCheckSpeakerEnergy()
|
||||||
self.run(
|
self.run(
|
||||||
200,
|
200,
|
||||||
self.run_mapping["selected_speaker_device"],
|
self.run_mapping["selected_speaker_device"],
|
||||||
@@ -366,22 +382,24 @@ class Controller:
|
|||||||
return {"status":200, "result":config.ENABLE_FOREGROUND}
|
return {"status":200, "result":config.ENABLE_FOREGROUND}
|
||||||
|
|
||||||
def setEnableConfigWindow(self, *args, **kwargs) -> dict:
|
def setEnableConfigWindow(self, *args, **kwargs) -> dict:
|
||||||
|
config.IS_OPENED_CONFIG_WINDOW = True
|
||||||
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
self.stopThreadingTranscriptionSendMessageOnOpenConfigWindow()
|
self.stopThreadingTranscriptionSendMessage()
|
||||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
self.stopThreadingTranscriptionReceiveMessageOnOpenConfigWindow()
|
self.stopThreadingTranscriptionReceiveMessage()
|
||||||
return {"status":200, "result":True}
|
return {"status":200, "result":True}
|
||||||
|
|
||||||
def setDisableConfigWindow(self, *args, **kwargs) -> dict:
|
def setDisableConfigWindow(self, *args, **kwargs) -> dict:
|
||||||
|
config.IS_OPENED_CONFIG_WINDOW = False
|
||||||
model.stopCheckMicEnergy()
|
model.stopCheckMicEnergy()
|
||||||
model.stopCheckSpeakerEnergy()
|
model.stopCheckSpeakerEnergy()
|
||||||
|
|
||||||
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
if config.ENABLE_TRANSCRIPTION_SEND is True:
|
||||||
self.startThreadingTranscriptionSendMessageOnCloseConfigWindow()
|
self.startThreadingTranscriptionSendMessage()
|
||||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
sleep(2)
|
sleep(2)
|
||||||
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
if config.ENABLE_TRANSCRIPTION_RECEIVE is True:
|
||||||
self.startThreadingTranscriptionReceiveMessageOnCloseConfigWindow()
|
self.startThreadingTranscriptionReceiveMessage()
|
||||||
return {"status":200, "result":True}
|
return {"status":200, "result":True}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -1412,23 +1430,6 @@ class Controller:
|
|||||||
th_stopTranscriptionSendMessage.start()
|
th_stopTranscriptionSendMessage.start()
|
||||||
th_stopTranscriptionSendMessage.join()
|
th_stopTranscriptionSendMessage.join()
|
||||||
|
|
||||||
def startTranscriptionSendMessageOnCloseConfigWindow(self) -> None:
|
|
||||||
model.startMicTranscript(self.micMessage)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def stopTranscriptionSendMessageOnOpenConfigWindow() -> None:
|
|
||||||
model.stopMicTranscript()
|
|
||||||
|
|
||||||
def startThreadingTranscriptionSendMessageOnCloseConfigWindow(self) -> None:
|
|
||||||
th_startTranscriptionSendMessage = Thread(target=self.startTranscriptionSendMessageOnCloseConfigWindow)
|
|
||||||
th_startTranscriptionSendMessage.daemon = True
|
|
||||||
th_startTranscriptionSendMessage.start()
|
|
||||||
|
|
||||||
def stopThreadingTranscriptionSendMessageOnOpenConfigWindow(self) -> None:
|
|
||||||
th_stopTranscriptionSendMessage = Thread(target=self.stopTranscriptionSendMessageOnOpenConfigWindow)
|
|
||||||
th_stopTranscriptionSendMessage.daemon = True
|
|
||||||
th_stopTranscriptionSendMessage.start()
|
|
||||||
|
|
||||||
def startTranscriptionReceiveMessage(self) -> None:
|
def startTranscriptionReceiveMessage(self) -> None:
|
||||||
model.startSpeakerTranscript(self.speakerMessage)
|
model.startSpeakerTranscript(self.speakerMessage)
|
||||||
|
|
||||||
@@ -1447,23 +1448,6 @@ class Controller:
|
|||||||
th_stopTranscriptionReceiveMessage.start()
|
th_stopTranscriptionReceiveMessage.start()
|
||||||
th_stopTranscriptionReceiveMessage.join()
|
th_stopTranscriptionReceiveMessage.join()
|
||||||
|
|
||||||
def startTranscriptionReceiveMessageOnCloseConfigWindow(self) -> None:
|
|
||||||
model.startSpeakerTranscript(self.speakerMessage)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def stopTranscriptionReceiveMessageOnOpenConfigWindow() -> None:
|
|
||||||
model.stopSpeakerTranscript()
|
|
||||||
|
|
||||||
def startThreadingTranscriptionReceiveMessageOnCloseConfigWindow(self) -> None:
|
|
||||||
th_startTranscriptionReceiveMessage = Thread(target=self.startTranscriptionReceiveMessageOnCloseConfigWindow)
|
|
||||||
th_startTranscriptionReceiveMessage.daemon = True
|
|
||||||
th_startTranscriptionReceiveMessage.start()
|
|
||||||
|
|
||||||
def stopThreadingTranscriptionReceiveMessageOnOpenConfigWindow(self) -> None:
|
|
||||||
th_stopTranscriptionReceiveMessage = Thread(target=self.stopTranscriptionReceiveMessageOnOpenConfigWindow)
|
|
||||||
th_stopTranscriptionReceiveMessage.daemon = True
|
|
||||||
th_stopTranscriptionReceiveMessage.start()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def replaceExclamationsWithRandom(text):
|
def replaceExclamationsWithRandom(text):
|
||||||
# ![...] にマッチする正規表現
|
# ![...] にマッチする正規表現
|
||||||
|
|||||||
Reference in New Issue
Block a user