tweak speech drivers

This commit is contained in:
chrys 2016-07-06 00:43:04 +02:00
parent b48bc02e6b
commit 5b3e5eecf6
3 changed files with 16 additions and 1 deletions

View File

@ -48,8 +48,9 @@ while(runtime['running']):
if runtime['oldContentBytes'] != runtime['newContentBytes']:
if len(runtime['delta']) < 3:
runtime['speechDriver'].cancel()
print(len(runtime['delta']))
print("tty3 changed")
print(runtime['delta'])
diff = difflib.ndiff(runtime['oldContentText'], runtime['newContentText'])
runtime['delta'] = ''.join(x[2:] for x in diff if x.startswith('+ '))

View File

@ -46,5 +46,9 @@ class speech():
if not self.isInitialized:
return False
return es.set_parameter(espeak.Parameter.Rate, speed)
def setModule(self, module):
pass
def shutdown(self):
pass

View File

@ -59,6 +59,16 @@ class speech():
except:
return False
def setModule(self, module):
if not self.isInitialized:
return False
try:
self.sd..set_output_module(module)
return True
except:
return False
def shutdown(self):
self.cancel()
self.sd.close()