From fe9694074403b88673cff893cf9aeaffb7130c5f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 12 Jul 2019 14:55:14 +0200 Subject: [PATCH] detect_sound should support relative and ~ paths --- platypush/backend/assistant/snowboy/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platypush/backend/assistant/snowboy/__init__.py b/platypush/backend/assistant/snowboy/__init__.py index 1ccb407be..894f52648 100644 --- a/platypush/backend/assistant/snowboy/__init__.py +++ b/platypush/backend/assistant/snowboy/__init__.py @@ -104,10 +104,13 @@ class AssistantSnowboyBackend(Backend): raise AttributeError('Duplicate model key {}'.format(name)) model_file = conf.get('voice_model_file') + detect_sound = conf.get('detect_sound') + if not model_file: raise AttributeError('No voice_model_file specified for model {}'.format(name)) model_file = os.path.abspath(os.path.expanduser(model_file)) + detect_sound = os.path.abspath(os.path.expanduser(detect_sound)) assistant_plugin_name = conf.get('assistant_plugin') if not os.path.isfile(model_file): @@ -116,7 +119,7 @@ class AssistantSnowboyBackend(Backend): self.models[name] = { 'voice_model_file': model_file, 'sensitivity': conf.get('sensitivity', 0.5), - 'detect_sound': conf.get('detect_sound'), + 'detect_sound': detect_sound, 'assistant_plugin': get_plugin(assistant_plugin_name) if assistant_plugin_name else None, 'assistant_language': conf.get('assistant_language'), }