- Better MPD filter management - you can now pass filters as arrays like

['artist', 'Led Zeppelin', 'title', 'Stairway To Heaven'] instead of
relying on one single type-filter pair

- Improved condition matching - don't skip the last condition token if
there are still event tokens to add
This commit is contained in:
Fabio Manganiello 2018-04-14 23:58:48 +02:00
parent 82200bb150
commit 73c74654d1
3 changed files with 13 additions and 17 deletions

View file

@ -654,16 +654,14 @@ $(document).ready(function() {
if ('any' in searchData) {
args = {
type: 'any',
filter: searchData.any
filter: ['any', searchData.any]
};
searchFilters.any = searchData.any;
} else {
if ('title' in searchData) {
args = {
type: 'title',
filter: searchData.title
filter: ['title', searchData.title]
};
searchFilters.title = searchData.title;
@ -671,8 +669,7 @@ $(document).ready(function() {
if ('album' in searchData) {
args = {
type: 'album',
filter: searchData.album
filter: ['album', searchData.album]
};
searchFilters.album = searchData.album;
@ -680,8 +677,7 @@ $(document).ready(function() {
if ('albumartist' in searchData) {
args = {
type: 'albumartist',
filter: searchData.albumartist
filter: ['albumartist', searchData.albumartist]
};
searchFilters.albumartist = searchData.albumartist;

View file

@ -137,7 +137,7 @@ class Event(Message):
result.parsed_args[argname] += ' ' + event_token
if len(condition_tokens) == 1 \
if (len(condition_tokens) == 1 and len(event_tokens) == 1) \
or (len(event_tokens) > 1 and len(condition_tokens) > 1 \
and event_tokens[1] == condition_tokens[1]):
# Stop appending tokens to this argument, as the next

View file

@ -121,21 +121,21 @@ class MusicMpdPlugin(MusicPlugin):
def plchanges(self, version):
return Response(output=self.client.plchanges(version))
def find(self, type, filter, *args, **kwargs):
def find(self, filter, *args, **kwargs):
return Response(
output=self.client.find(type, filter, *args, **kwargs))
output=self.client.find(*filter, *args, **kwargs))
def findadd(self, type, filter, *args, **kwargs):
def findadd(self, filter, *args, **kwargs):
return Response(
output=self.client.findadd(type, filter, *args, **kwargs))
output=self.client.findadd(*filter, *args, **kwargs))
def search(self, type, filter, *args, **kwargs):
def search(self, filter, *args, **kwargs):
return Response(
output=self.client.search(type, filter, *args, **kwargs))
output=self.client.search(*filter, *args, **kwargs))
def searchadd(self, type, filter, *args, **kwargs):
def searchadd(self, filter, *args, **kwargs):
return Response(
output=self.client.searchadd(type, filter, *args, **kwargs))
output=self.client.searchadd(*filter, *args, **kwargs))
# vim:sw=4:ts=4:et: