From 4a1087463918a062c167261cbfffb1d35e34699e Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Thu, 8 Oct 2020 19:48:27 +0200 Subject: [PATCH] Added error/what handeling --- speech_daemon.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/speech_daemon.py b/speech_daemon.py index f5981f9..f381b03 100755 --- a/speech_daemon.py +++ b/speech_daemon.py @@ -34,16 +34,19 @@ class speech_daemon(object): global CONFIG CONFIG = cfg - self.deviceIndex = CONFIG["speech"]["device_index"] + self.deviceIndex = CONFIG["speech"]["device_index"] # Apply the device index def start(self): controller.init() for inp in self.voiceInpObj.start( self.deviceIndex ): - cmdBuf = inp.lower().split(" ") - if( cmdBuf[0] in CONFIG["speech"]["prefixes"] ): - print("CMD:", cmdBuf) - parseCommandline( cmdBuf, False ) + if( inp != self.voiceInpObj.error and inp != self.voiceInpObj.what ): + cmdBuf = inp.lower().split(" ") + if( cmdBuf[0] in CONFIG["speech"]["prefixes"] ): + print("CMD:", cmdBuf) + parseCommandline( cmdBuf, False ) + else: + print("Error/What: {0}".format(inp)) controller.end()