From 2b8ba2b956d20a77f3d64c4daf47604c79324264 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 26 Nov 2019 11:19:15 +0100 Subject: [PATCH] Support for specifying external audio player on Alexa plugin --- platypush/plugins/assistant/echo/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platypush/plugins/assistant/echo/__init__.py b/platypush/plugins/assistant/echo/__init__.py index 2ba5c8b41..894ed7316 100644 --- a/platypush/plugins/assistant/echo/__init__.py +++ b/platypush/plugins/assistant/echo/__init__.py @@ -43,7 +43,8 @@ class AssistantEchoPlugin(AssistantPlugin): * **avs** (``pip install avs``) """ - def __init__(self, avs_config_file: str = DEFAULT_CONFIG_FILE, audio_device: str = 'default', **kwargs): + def __init__(self, avs_config_file: str = DEFAULT_CONFIG_FILE, audio_device: str = 'default', + audio_player: str = 'default', **kwargs): """ :param avs_config_file: AVS credentials file - default: ~/.avs.json. If the file doesn't exist then an instance of the AVS authentication service will be spawned. You can login through an Amazon @@ -51,6 +52,8 @@ class AssistantEchoPlugin(AssistantPlugin): in the browser on another machine. :param audio_device: Name of the input audio device (default: 'default') + :param audio_player: Player to be used for audio playback (default: 'default'). + Supported values: 'mpv', 'mpg123', 'gstreamer' """ super().__init__(**kwargs) @@ -60,8 +63,9 @@ class AssistantEchoPlugin(AssistantPlugin): 'to authenticate this client') self.audio_device = audio_device + self.audio_player = audio_player self.audio = Audio(device_name=audio_device) - self.alexa = Alexa(avs_config_file) + self.alexa = Alexa(avs_config_file, audio_player=audio_player) self._ready = False self.alexa.state_listener.on_ready = self._on_ready()