forked from platypush/platypush
Added music.mpd.searchaddplaylist method
This commit is contained in:
parent
87fb8855b7
commit
f717315136
1 changed files with 14 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue