From: kaliko Date: Wed, 7 Jan 2015 17:17:53 +0000 (+0100) Subject: Better extra art addition X-Git-Tag: 0.13.0~3 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=c225e922bbeed1d989d1a74ab0a639aa4972c7f1;p=mpd-sima.git Better extra art addition --- diff --git a/sima/lib/webserv.py b/sima/lib/webserv.py index 9eb76ba..f0b5946 100644 --- a/sima/lib/webserv.py +++ b/sima/lib/webserv.py @@ -243,6 +243,8 @@ class WebService(Plugin): if ret: self.log.debug('regular found in library: {}'.format( ' / '.join(map(str, ret)))) + else: + self.log.debug('Got nothing similar from library!') ret_extra = None if len(self.history) >= 2: if self.plugin_conf.getint('depth') > 1: @@ -250,8 +252,11 @@ class WebService(Plugin): if ret_extra: # get them reorg to pick up best element ret_extra = self._get_artists_list_reorg(ret_extra) - # pickup half the number of ret artist - ret_extra = MetaContainer(ret_extra[:max(4, len(ret))//2]) + # tries to pickup less artist from extra art + if len(ret) < 4: + ret_extra = MetaContainer(ret_extra) + else: + ret_extra = MetaContainer(ret_extra[:max(4, len(ret))//2]) if ret_extra: self.log.debug('extra found in library: {}'.format( ' / '.join(map(str, ret_extra))))