From 96e3acb20f053237880e61fbf4b1745374c6ec1e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 25 May 2018 18:04:32 +0200 Subject: [PATCH] Added MPD play_if_paused and pause_if_playing methods --- platypush/plugins/music/mpd/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index db626f50..56b98c02 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -37,6 +37,16 @@ class MusicMpdPlugin(MusicPlugin): if status == 'play': return self._exec('pause') else: return self._exec('play') + def pause_if_playing(self): + status = self.status().output['state'] + if status == 'play': return self._exec('pause') + else: return Response(output={}) + + def play_if_paused(self): + status = self.status().output['state'] + if status == 'pause': return self._exec('play') + else: return Response(output={}) + def stop(self): return self._exec('stop')