From b88f7fcecc2c64f914f423725278dd8512e7d460 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 25 Sep 2018 19:40:00 +0200 Subject: [PATCH] Added play_if_paused_or_stopped method to mpd plugin --- platypush/plugins/music/mpd/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index fb31ab40..afa1ecf1 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -87,6 +87,14 @@ class MusicMpdPlugin(MusicPlugin): if status == 'pause': return self._exec('play') + @action + def play_if_paused_or_stopped(self): + """ Play only if it's paused or stopped """ + + status = self.status().output['state'] + if status == 'pause' or status == 'stop': + return self._exec('play') + @action def stop(self): """ Stop playback """