WIP emacspeakDriver

This commit is contained in:
chrys 2017-10-28 12:08:31 +02:00
parent 354aa30273
commit 7a4c52defe

View File

@ -19,11 +19,12 @@ class driver(speechDriver):
def initialize(self, environment):
self.env = environment
try:
self.server = ptyprocess.PtyProcessUnicode.spawn(['tclsh ', self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath')])
self.server = ptyprocess.PtyProcessUnicode.spawn(['/usr/bin/tclsh', self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath')])
#self.server = pexpect.spawnu('tclsh ' + self.env['runtime']['settingsManager'].getSetting('speech', 'serverPath'))
self._isInitialized = True
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:initialize:' + str(e),debug.debugLevel.ERROR)
self._isInitialized = True
print(e)
def shutdown(self):
if self.server:
@ -44,8 +45,9 @@ class driver(speechDriver):
cleanText = cleanText.replace('"', '\"')
cleanText = cleanText.replace('\n', ' ')
cleanText = cleanText.replace('[', '\[')
#print(text.replace('"', '\\\"'))
print(text.replace('"', '\\\"'))
self.server.write('tts_say ' + '"' + cleanText +'"\n')
print(self.server.read(1000))
#self.server.sendline('tts_say ' + '"' + cleanText +'"')
except Exception as e:
self.env['runtime']['debug'].writeDebugOut('speechDriver:speak:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
@ -55,8 +57,11 @@ class driver(speechDriver):
return
try:
self.server.write('s\n')
print('drin')
print(self.server.read(1000))
#self.server.sendline('s')
except Exception as e:
print(e)
self.env['runtime']['debug'].writeDebugOut('speechDriver:cancel:self.server.sendline():' + str(e),debug.debugLevel.ERROR)
def setRate(self, rate):