From 45a38cdaf1510c1b17c8ecb1f830b9792de7b071 Mon Sep 17 00:00:00 2001 From: Javier Domingo Cansino Date: Thu, 7 Nov 2013 10:51:29 +0100 Subject: [PATCH] core: Changing input to accept also sets, as might be also used. --- mopidy/core/tracklist.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/core/tracklist.py b/mopidy/core/tracklist.py index 5c2d91e0..584a8bb9 100644 --- a/mopidy/core/tracklist.py +++ b/mopidy/core/tracklist.py @@ -290,7 +290,8 @@ class TracklistController(object): def filter(self, criteria=None, **kwargs): """ - Filter the tracklist by the given criterias. + Filter the tracklist by the given criterias. The value of the field to + check can be a list or a set. Examples:: @@ -333,7 +334,7 @@ class TracklistController(object): criteria = criteria or kwargs matches = self._tl_tracks for (key, value) in criteria.iteritems(): - if not type(value) is list: + if not type(value) in [list, set]: value = [value] if key == 'tlid': matches = filter(lambda ct: ct.tlid in value, matches)