]> kaliko git repositories - mpd-sima.git/commitdiff
Fetch as much as possible from echonest
authorkaliko <efrim@azylum.org>
Fri, 7 Feb 2014 21:59:16 +0000 (22:59 +0100)
committerkaliko <efrim@azylum.org>
Sat, 8 Feb 2014 13:11:43 +0000 (14:11 +0100)
sima/lib/simaecho.py
sima/plugins/internal/echonest.py
sima/utils/config.py

index 3c7528ff9de2064409ea76fba88fb7ec625477a9..310bff110fc9558f925de5b28f4ca55beee38026 100644 (file)
@@ -141,7 +141,7 @@ class SimaEch():
                                  Cache(self.current_element)})
 
     def _controls_answer(self):
-        """Controls last.fm answer.
+        """Controls answer.
         """
         status = self.current_element.get('response').get('status')
         code = status.get('code')
@@ -164,7 +164,7 @@ class SimaEch():
         else:
            payload.update(name=artist.name)
         payload.update(bucket='id:musicbrainz')
-        payload.update(results=30)
+        payload.update(results=100)
         return payload
 
     def get_similar(self, artist=None):
index 9631d702ed3e6cefc5715f8107ec4c59c4cf0ee8..bcccff62eda46d4f0b35a04e316b84cb31733437 100644 (file)
@@ -175,7 +175,10 @@ class EchoNest(Plugin):
         as_artists = simaech.get_similar(artist=current)
         self.log.debug('Requesting EchoNest for "{0}"'.format(current))
         try:
-            [as_art.append(str(a)) for a in as_artists]
+            for art in as_artists:
+                if len(as_art) > self.plugin_conf.getint('artists'):
+                    break
+                as_art.append(str(art))
         except EchoNotFound as err:
             self.log.warning(err)
         except EchoError as err:
@@ -313,7 +316,7 @@ class EchoNest(Plugin):
                             'history getting too large?')
             return None
         for track in self.to_add:
-            self.log.info('last.fm candidate: {0!s}'.format(track))
+            self.log.info('echonest candidates: {0!s}'.format(track))
 
     def _album(self):
         """Get albums for album queue mode
index 2670a78dcc1c17605933d16e5fb140010914f330..42c010329c2ab12e80ce8dab1022beb694def9c9 100644 (file)
@@ -62,6 +62,7 @@ DEFAULT_CONF = {
             },
         'echonest': {
             'queue_mode': "track", #TODO control values
+            'artists': "80",
             'single_album': "false",
             'track_to_add': "1",
             'album_to_add': "1",