From 26a56001284765c66cfb13fb0db45bc7d38730fa Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Wed, 24 Apr 2024 19:18:01 -0700 Subject: [PATCH] Update for ovos-utils 0.1 Compat (#27) Update references to support ovos-utils 0.1 Co-authored-by: Daniel McKnight --- ovos_listener/mic.py | 12 ++++++++---- ovos_listener/service.py | 2 +- requirements.txt | 10 +++++----- requirements/tests.txt | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ovos_listener/mic.py b/ovos_listener/mic.py index e56430d..ac27c12 100644 --- a/ovos_listener/mic.py +++ b/ovos_listener/mic.py @@ -36,7 +36,7 @@ from ovos_utils.log import LOG from ovos_utils.messagebus import get_message_lang from ovos_utils.signal import check_for_signal, get_ipc_directory -from ovos_utils.sound import play_audio, play_listening_sound, play_end_listening_sound +from ovos_utils.sound import play_audio from speech_recognition import ( Microphone, AudioSource, @@ -673,7 +673,9 @@ def trigger_listen(self): LOG.info('Listen triggered from external source.') self._listen_triggered = True if self.config.get("confirm_listening"): - play_listening_sound() + sound = self.config.get("sounds", {}).get("start_listening") + if sound: + play_audio(resolve_resource_file(sound)) def _upload_hotword(self, audio, metadata): """Upload the wakeword in a background thread.""" @@ -747,7 +749,7 @@ def _handle_hotword_found(self, hotword, audio_data, source): # indicate hotword was detected. if sound: try: - sound = resolve_resource_file(sound) + sound = resolve_resource_file(sound, config=self.config) if self.instant_listen or not listen: play_audio(sound) else: @@ -947,7 +949,9 @@ def listen(self, source, stream): return None, lang LOG.debug("Thinking...") - play_end_listening_sound() + sound = self.config.get("sounds", {}).get("end_listening") + if sound: + play_audio(resolve_resource_file(sound)) return audio_data, lang def _listen_phrase(self, source, sec_per_buffer, stream): diff --git a/ovos_listener/service.py b/ovos_listener/service.py index 255ad51..d0132f7 100644 --- a/ovos_listener/service.py +++ b/ovos_listener/service.py @@ -21,7 +21,7 @@ from ovos_plugin_manager.stt import get_stt_lang_configs, get_stt_supported_langs, get_stt_module_configs from ovos_plugin_manager.vad import get_vad_configs from ovos_plugin_manager.wakewords import get_ww_lang_configs, get_ww_supported_langs, get_ww_module_configs -from ovos_utils.enclosure.api import EnclosureAPI +from ovos_bus_client.apis.enclosure import EnclosureAPI from ovos_utils.log import LOG from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap diff --git a/requirements.txt b/requirements.txt index 081d7f7..c93471a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,14 +5,14 @@ ovos-vad-plugin-webrtcvad ovos-ww-plugin-pocketsphinx~=0.1, >=0.1.3 # NOTE - either tflite or tensorflow must be installed manually in addition to precise-lite -ovos-ww-plugin-precise-lite~=0.1, >=0.1.2a3 +ovos-ww-plugin-precise-lite~=0.1, >=0.1.2 ovos-ww-plugin-vosk ovos-stt-plugin-server~=0.0, >=0.0.2 ovos-stt-plugin-vosk~=0.1 -ovos-utils~=0.0, >=0.0.31a3 +ovos-utils~=0.0, >=0.0.31 ovos-bus-client>=0.0.3a16,~=0.0 -ovos-plugin-manager~=0.0, >=0.0.23a5 -ovos-config~=0.0,>=0.0.8a3 -ovos_backend_client~=0.0, >=0.0.7a2 +ovos-plugin-manager~=0.0, >=0.0.23 +ovos-config~=0.0,>=0.0.8 +ovos_backend_client~=0.0, >=0.0.7 diff --git a/requirements/tests.txt b/requirements/tests.txt index 37ddcde..e0a1acf 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -2,5 +2,5 @@ pytest==5.2.4 pytest-cov==2.8.1 cov-core==1.15.0 -ovos-stt-plugin-selene>=0.0.3a3 +ovos-stt-plugin-selene>=0.0.3 ovos-stt-plugin-vosk>=0.1.3 \ No newline at end of file