add debut to speech-drivers

This commit is contained in:
chrys 2016-10-22 12:55:21 +02:00
parent 141377b7b8
commit 483fd21952
3 changed files with 13 additions and 7 deletions

View File

@ -34,7 +34,7 @@ class driver():
currScreen = self.env['screenData']['newTTY'] currScreen = self.env['screenData']['newTTY']
apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n') apps = subprocess.Popen('ps -t tty' + currScreen + ' -o comm,tty,stat', shell=True, stdout=subprocess.PIPE).stdout.read().decode()[:-1].split('\n')
except Exception as e: except Exception as e:
print(e) self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
return return
try: try:
for i in apps: for i in apps:

View File

@ -11,14 +11,17 @@ class driver():
def __init__(self ): def __init__(self ):
self._es = None self._es = None
self._isInitialized = False self._isInitialized = False
def initialize(self, environment):
self.env = environment
try: try:
from espeak import espeak from espeak import espeak
self._es = espeak self._es = espeak
self._isInitialized = True self._isInitialized = True
except: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
self._initialized = False self._initialized = False
def initialize(self, environment):
self.env = environment
def shutdown(self): def shutdown(self):
pass pass

View File

@ -12,15 +12,18 @@ class driver():
self._sd = None self._sd = None
self._isInitialized = False self._isInitialized = False
self._language = '' self._language = ''
def initialize(self, environment):
self.env = environment
try: try:
import speechd import speechd
self._sd = speechd.SSIPClient('fenrir') self._sd = speechd.SSIPClient('fenrir')
self._punct = speechd.PunctuationMode() self._punct = speechd.PunctuationMode()
self._isInitialized = True self._isInitialized = True
except: except Exception as e:
self.env['runtime']['debug'].writeDebugOut(str(e),debug.debugLevel.ERROR)
self._initialized = False self._initialized = False
def initialize(self, environment):
self.env = environment
def shutdown(self): def shutdown(self):
if not self._isInitialized: if not self._isInitialized:
return return