From caaf8f55d7110428724949dee23dd23050e74eff Mon Sep 17 00:00:00 2001 From: kaliko Date: Mon, 17 Feb 2014 11:18:17 +0100 Subject: [PATCH] Fixed blacklisting decorator --- sima/client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 -- 2.39.5