]> kaliko git repositories - mpd-sima.git/commitdiff
Better extra art addition
authorkaliko <kaliko@azylum.org>
Wed, 7 Jan 2015 17:17:53 +0000 (18:17 +0100)
committerkaliko <kaliko@azylum.org>
Wed, 7 Jan 2015 17:17:53 +0000 (18:17 +0100)
sima/lib/webserv.py

index 9eb76bafcc79b87f912b89ef5ef11de6dc8cf51b..f0b5946ff6ec50be3577b9611d6e5a0a793b2e78 100644 (file)
@@ -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))))