Merge pull request #1909 from forslund/bugfix/shutdown-precise

Stop hotword engines when reloading
pull/1915/head
Matthew D. Scholefield 2018-12-19 19:02:33 -06:00 committed by GitHub
commit d95071070f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,14 @@ class HotWordEngine(object):
def update(self, chunk):
pass
def stop(self):
""" Perform any actions needed to shut down the hot word engine.
This may include things such as unload loaded data or shutdown
external processess.
"""
pass
class PocketsphinxHotWord(HotWordEngine):
def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):
@ -222,6 +230,10 @@ class PreciseHotword(HotWordEngine):
return True
return False
def stop(self):
if self.runner:
self.runner.stop()
class SnowboyHotWord(HotWordEngine):
def __init__(self, key_phrase="hey mycroft", config=None, lang="en-us"):

View File

@ -344,6 +344,7 @@ class RecognizerLoop(EventEmitter):
Reload configuration and restart consumer and producer
"""
self.stop()
self.wakeword_recognizer.stop()
# load config
self._load_config()
# restart