X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=listen.py;h=e431a0b199fa67073d315b42e8413187555ef1f1;hb=5ea88ab72e175e2d4f57ae8645ca6f825549a7a9;hp=4ddd774f16619751398a3636ffd4b4646219bc3a;hpb=5cd909241fefc418e495e633243403592339991a;p=kiosk.git diff --git a/listen.py b/listen.py index 4ddd774..e431a0b 100755 --- a/listen.py +++ b/listen.py @@ -9,7 +9,9 @@ import pyaudio import speech_recognition as sr from pyutils import logging_utils -logger = logging.getLogger(__file__) +import kiosk_secrets as secrets + +logger = logging.getLogger(__name__) class HotwordListener(object): @@ -19,18 +21,18 @@ class HotwordListener(object): keyword_paths, sensitivities, input_device_index=None, - library_path=pvporcupine.LIBRARY_PATH, - model_path=pvporcupine.MODEL_PATH, +# library_path=pvporcupine.LIBRARY_PATH, +# model_path=pvporcupine.MODEL_PATH, ): self._queue = command_queue - self._library_path = library_path - self._model_path = model_path +# self._library_path = library_path +# self._model_path = model_path self._keyword_paths = keyword_paths self._sensitivities = sensitivities self._input_device_index = input_device_index + @logging_utils.LoggingContext(logger, prefix="listener:") def listen_forever(self): - logging_utils.register_thread_logging_prefix("listener:") keywords = list() for x in self._keyword_paths: keywords.append(os.path.basename(x).replace(".ppn", "").split("_")[0]) @@ -40,10 +42,9 @@ class HotwordListener(object): audio_stream = None try: porcupine = pvporcupine.create( - library_path=self._library_path, - model_path=self._model_path, keyword_paths=self._keyword_paths, sensitivities=self._sensitivities, + access_key=secrets.pvporcupine_key, ) recognizer = sr.Recognizer() pa = pyaudio.PyAudio()