From: kaliko Date: Mon, 17 Feb 2014 10:18:17 +0000 (+0100) Subject: Fixed blacklisting decorator X-Git-Tag: mpd-sima/0.12.0pr4~16 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=caaf8f55d7110428724949dee23dd23050e74eff;p=mpd-sima.git Fixed blacklisting decorator --- diff --git a/sima/client.py b/sima/client.py index 9bee62d..c04b259 100644 --- a/sima/client.py +++ b/sima/client.py @@ -66,16 +66,17 @@ def blacklist(artist=False, album=False, track=False): #bl_getter = next(fn for fn, bl in zip(bl_fun, boolgen) if bl is True) bl_getter = next(dropwhile(lambda _: not next(boolgen), bl_fun)) #cls.log.debug('using {0} as bl filter'.format(bl_getter.__name__)) - results = func(*args, **kwargs) - for elem in results: + results = list() + for elem in func(*args, **kwargs): if bl_getter(elem, add_not=True): - cls.log.info('Blacklisted: {0}'.format(elem)) - results.remove(elem) + cls.log.debug('Blacklisted "{0}"'.format(elem)) + continue if track and cls.database.get_bl_album(elem, add_not=True): # filter album as well in track mode # (artist have already been) - cls.log.info('Blacklisted: {0}'.format(elem)) - results.remove(elem) + cls.log.debug('Blacklisted alb. "{0.album}"'.format(elem)) + continue + results.append(elem) return results return wrapper return decorated