diff --git a/platypush/plugins/music/mpd/__init__.py b/platypush/plugins/music/mpd/__init__.py index e73a3e9e..18fc8ae2 100644 --- a/platypush/plugins/music/mpd/__init__.py +++ b/platypush/plugins/music/mpd/__init__.py @@ -121,6 +121,20 @@ class MusicMpdPlugin(MusicPlugin): def plchanges(self, version): return Response(output=self.client.plchanges(version)) + def searchaddplaylist(self, name): + playlists = list(map(lambda _: _['playlist'], + filter(lambda playlist: + name.lower() in playlist['playlist'].lower(), + self.client.listplaylists()))) + + if len(playlists): + self.client.clear() + self.client.load(playlists[0]) + self.client.play() + return Response(output={'playlist': playlists[0]}) + + return Response(output={}) + def find(self, filter, *args, **kwargs): return Response( output=self.client.find(*filter, *args, **kwargs))