Adding a 'to list' conversion and correcting horrible mistake in comparison (put it reverse)

This commit is contained in:
Javier Domingo Cansino 2013-11-05 13:17:55 +01:00
parent 808770733f
commit 32b01f4e4a

View File

@ -317,11 +317,13 @@ class TracklistController(object):
criteria = criteria or kwargs criteria = criteria or kwargs
matches = self._tl_tracks matches = self._tl_tracks
for (key, value) in criteria.iteritems(): for (key, value) in criteria.iteritems():
if not type(value) is list:
value = [value]
if key == 'tlid': if key == 'tlid':
matches = filter(lambda ct: value in ct.tlid, matches) matches = filter(lambda ct: ct.tlid in value, matches)
else: else:
matches = filter( matches = filter(
lambda ct: value in getattr(ct.track, key), matches) lambda ct: getattr(ct.track, key) in value, matches)
return matches return matches
def move(self, start, end, to_position): def move(self, start, end, to_position):