change syntax
This commit is contained in:
parent
ea60f41fcc
commit
800e950a7e
@ -39,7 +39,8 @@ class remoteManager():
|
|||||||
pass
|
pass
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
self.env = environment
|
self.env = environment
|
||||||
|
self.env['runtime']['processManager'].addCustomEventThread(self.unixSocketWatchDog, multiprocess=True)
|
||||||
|
return
|
||||||
if self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enabled'):
|
if self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enabled'):
|
||||||
if self.env['runtime']['settingsManager'].getSetting('remote', 'method') == 'unix':
|
if self.env['runtime']['settingsManager'].getSetting('remote', 'method') == 'unix':
|
||||||
self.env['runtime']['processManager'].addCustomEventThread(self.unixSocketWatchDog, multiprocess=True)
|
self.env['runtime']['processManager'].addCustomEventThread(self.unixSocketWatchDog, multiprocess=True)
|
||||||
@ -73,10 +74,9 @@ class remoteManager():
|
|||||||
rawdata = client_sock.recv(8129)
|
rawdata = client_sock.recv(8129)
|
||||||
try:
|
try:
|
||||||
data = rawdata.decode("utf-8").rstrip().lstrip()
|
data = rawdata.decode("utf-8").rstrip().lstrip()
|
||||||
if data.startswith('#<=>#'):
|
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
|
||||||
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
|
"Data": data
|
||||||
"Data": data
|
})
|
||||||
})
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
client_sock.close()
|
client_sock.close()
|
||||||
@ -104,10 +104,9 @@ class remoteManager():
|
|||||||
rawdata = client_sock.recv(8129)
|
rawdata = client_sock.recv(8129)
|
||||||
try:
|
try:
|
||||||
data = rawdata.decode("utf-8").rstrip().lstrip()
|
data = rawdata.decode("utf-8").rstrip().lstrip()
|
||||||
if data.startswith('#<=>#'):
|
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
|
||||||
eventQueue.put({"Type":fenrirEventType.RemoteIncomming,
|
"Data": data
|
||||||
"Data": data
|
})
|
||||||
})
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
client_sock.close()
|
client_sock.close()
|
||||||
@ -117,18 +116,18 @@ class remoteManager():
|
|||||||
def handleSettingsChange(self, settingsText):
|
def handleSettingsChange(self, settingsText):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableSettingsRemote'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableSettingsRemote'):
|
||||||
return
|
return
|
||||||
if settingsText.startswith('set##'):
|
if settingsText.startswith('set '):
|
||||||
parameterText = settingsText[len('set##'):]
|
parameterText = settingsText[len('set '):]
|
||||||
self.setSettings(parameterText)
|
self.setSettings(parameterText)
|
||||||
if settingsText.startswith('reset'):
|
if settingsText.startswith('reset'):
|
||||||
self.resetSettings()
|
self.resetSettings()
|
||||||
def handleCommandExecution(self, commandText):
|
def handleCommandExecution(self, commandText):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'):
|
||||||
return
|
return
|
||||||
if commandText.startswith('exec#say##'):
|
if commandText.startswith('say '):
|
||||||
parameterText = commandText[len('exec#say##'):]
|
parameterText = commandText[len('say '):]
|
||||||
self.execSay(parameterText)
|
self.execSay(parameterText)
|
||||||
if commandText.startswith('cancel##say'):
|
if commandText.startswith('interrupt'):
|
||||||
self.execInterruptSpeech()
|
self.execInterruptSpeech()
|
||||||
def execSay(self, text):
|
def execSay(self, text):
|
||||||
self.env['runtime']['outputManager'].speakText(text)
|
self.env['runtime']['outputManager'].speakText(text)
|
||||||
@ -143,17 +142,15 @@ class remoteManager():
|
|||||||
return
|
return
|
||||||
# examples
|
# examples
|
||||||
# settings:
|
# settings:
|
||||||
# #<=>#settings##set##section#setting=value[,section#setting=value]
|
# settings set section#setting=value[,section#setting=value]
|
||||||
# #<=>#settings##set##speech#voice=de
|
# setting set speech#voice=de
|
||||||
# #<=>#settings##reset
|
# setting reset
|
||||||
# execute command:
|
# execute command:
|
||||||
# #<=>#command##exec#say##this is a test
|
# command say this is a test
|
||||||
# #<=>#command##cancel##say
|
# command interrupt
|
||||||
if not eventData.startswith('#<=>#'):
|
if eventData.startswith('setting '):
|
||||||
return
|
settingsText = eventData[len('setting '):]
|
||||||
if eventData.startswith('#<=>#settings##'):
|
|
||||||
settingsText = eventData[len('#<=>#settings##'):]
|
|
||||||
self.handleSettingsChange(settingsText)
|
self.handleSettingsChange(settingsText)
|
||||||
elif eventData.startswith('#<=>#command##'):
|
elif eventData.startswith('command '):
|
||||||
commandText = eventData[len('#<=>#command##'):]
|
commandText = eventData[len('command '):]
|
||||||
self.handleCommandExecution(commandText)
|
self.handleCommandExecution(commandText)
|
||||||
|
Loading…
Reference in New Issue
Block a user