From ab3c967c335d3d4366b04bee167b036b0460c637 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Sat, 19 Oct 2024 13:20:45 +0100 Subject: [PATCH 1/3] fix:save utterances (#148) * fix:save utterances backwards compat check wasnt quite right in https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/140 ``` Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: 2024-10-19 08:04:47.463 - voice - ovos_dinkum_listener.service:_stt_audio:747 - ERROR - Error while saving STT audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: Traceback (most recent call last): Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 742, in _stt_audio Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: stt_context["filename"] = self._save_stt(audio_bytes, stt_context) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 707, in _save_stt Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: filename = formatter.format(utterance_filename) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 107, in format Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw = self._build_fmtkw(template, **kwargs) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/_util.py", line 91, in _build_fmtkw Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: fmtkw[key] = builder() Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_dinkum_listener/service.py", line 705, in transcription_md5 Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: return hash_sentence(text) Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: File "/home/goldyfruit/.venvs/ovos/lib64/python3.11/site-packages/ovos_plugin_manager/utils/tts_cache.py", line 20, in hash_sentence Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: encoded_sentence = sentence.encode("utf-8", "ignore") Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: ^^^^^^^^^^^^^^^ Oct 19 08:04:47 x270.home.lan ovos-dinkum-listener[152114]: AttributeError: 'NoneType' object has no attribute 'encode' ``` also needs https://github.com/OpenVoiceOS/ovos-config/pull/171 * Update requirements.txt --- ovos_dinkum_listener/service.py | 14 ++++++-------- requirements/requirements.txt | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ovos_dinkum_listener/service.py b/ovos_dinkum_listener/service.py index ae5d05a..3359b25 100644 --- a/ovos_dinkum_listener/service.py +++ b/ovos_dinkum_listener/service.py @@ -692,16 +692,14 @@ def _save_stt(self, audio_bytes, stt_meta, save_path=None): @formatter.register('md5') def transcription_md5(): # Build a hash of the transcription + try: - # handles legacy API - text = stt_meta.get('transcription') - except KeyError: - # handles new API # transcriptions should be : List[Tuple[str, int]] - try: - text = stt_meta.get('transcriptions')[0][0] - except IndexError: - return 'null' + text = stt_meta.get('transcriptions')[0][0] + except IndexError: + # handles legacy API + return stt_meta.get('transcription') or 'null' + return hash_sentence(text) filename = formatter.format(utterance_filename) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index a02fc8b..f34fe8d 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,5 +1,5 @@ ovos-plugin-manager>=0.3.1,<1.0.0 ovos-utils>=0.0.38,<1.0.0 -ovos-config>=0.2.1,<1.0.0 +ovos-config>=0.4.3,<1.0.0 ovos_bus_client>=0.0.10,<1.0.0 SpeechRecognition~=3.9 From f4d7a0fbd65fd7b457fc55607c816630ee01cf6e Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sat, 19 Oct 2024 12:21:01 +0000 Subject: [PATCH 2/3] Increment Version to 0.2.3a1 --- ovos_dinkum_listener/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ovos_dinkum_listener/version.py b/ovos_dinkum_listener/version.py index 7c5bb01..f245d8d 100644 --- a/ovos_dinkum_listener/version.py +++ b/ovos_dinkum_listener/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 2 -VERSION_BUILD = 2 -VERSION_ALPHA = 0 +VERSION_BUILD = 3 +VERSION_ALPHA = 1 # END_VERSION_BLOCK From 7f9c7e747ef14890bfafca58a736da332b419f3c Mon Sep 17 00:00:00 2001 From: JarbasAl Date: Sat, 19 Oct 2024 12:21:24 +0000 Subject: [PATCH 3/3] Update Changelog --- CHANGELOG.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 968332e..502e085 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,12 @@ # Changelog -## [0.2.1a1](https://github.com/OpenVoiceOS/ovos-dinkum-listener/tree/0.2.1a1) (2024-09-15) +## [0.2.3a1](https://github.com/OpenVoiceOS/ovos-dinkum-listener/tree/0.2.3a1) (2024-10-19) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-dinkum-listener/compare/0.2.0a1...0.2.1a1) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-dinkum-listener/compare/0.2.2...0.2.3a1) **Merged pull requests:** -- fix:prefer\_alsa [\#144](https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/144) ([JarbasAl](https://github.com/JarbasAl)) - -## [0.2.0a1](https://github.com/OpenVoiceOS/ovos-dinkum-listener/tree/0.2.0a1) (2024-09-11) - -[Full Changelog](https://github.com/OpenVoiceOS/ovos-dinkum-listener/compare/0.1.3...0.2.0a1) - -**Merged pull requests:** - -- feat:fallback plugins [\#138](https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/138) ([JarbasAl](https://github.com/JarbasAl)) +- fix:save utterances [\#148](https://github.com/OpenVoiceOS/ovos-dinkum-listener/pull/148) ([JarbasAl](https://github.com/JarbasAl))