]> kaliko git repositories - mpd-sima.git/commitdiff
Use albumartist to fetch similar artists
authorkaliko <kaliko@azylum.org>
Tue, 18 Nov 2014 22:29:17 +0000 (23:29 +0100)
committerkaliko <kaliko@azylum.org>
Tue, 18 Nov 2014 22:29:17 +0000 (23:29 +0100)
doc/Changelog
sima/lib/track.py
sima/lib/webserv.py
tests/test_track.py

index 02dee066adf1a9ea810454f5866c2b2fa64854b2..72abd9f08aefbc2787aec43103fe9f6e800a6a82 100644 (file)
@@ -1,3 +1,10 @@
+MPD_sima v0.12.3 UNRELEASED
+
+ * Use albumartist to fetch similar artists
+
+-- kaliko jack <kaliko@azylum.org>  UNRELEASED
+
+
 MPD_sima v0.12.2
 
  * Add some randomness to track selection
index a938c2791776e912cc2991befeb9bb5dc45cd706..55fb3675403d81507b12fd1b87419e46c1e51a4c 100644 (file)
@@ -128,7 +128,8 @@ class Track:
 
     def get_artist(self):
        """Get artist object from track"""
-       return Artist(name=self.artist, mbid=self.musicbrainz_artistid)
+       return Artist(name=self.albumartist or self.artist,
+               mbid=self.musicbrainz_artistid)
 
 # VIM MODLINE
 # vim: ai ts=4 sw=4 sts=4 expandtab
index 4a048e9535696dbef3e6a03932ca2d60cea4b045..f1afd55a41b7e2f279fed0d3ec0d02bd28ec6594 100644 (file)
@@ -227,8 +227,7 @@ class WebService(Plugin):
         if not self.player.playlist:
             return []
         tolookfor = self.player.playlist[-1].get_artist()
-        self.log.info('Looking for artist similar '
-                      'to "{0.artist}"'.format(self.player.playlist[-1]))
+        self.log.info('Looking for artist similar to "{}"'.format(tolookfor))
         similar = self.ws_similar_artists(tolookfor)
         if not similar:
             self.log.info('Got nothing from {0}!'.format(self.ws.name))
index 12877845c1600ac6d61e6cbb4f10dd4c722d5641..e838a2016fb44d8e069ca302bcc30a327c0bed96 100644 (file)
@@ -32,4 +32,10 @@ class TestTrackObject(unittest.TestCase):
     def test_boolean_type(self):
         self.assertFalse(bool(Track()))
 
+    def test_albumartist(self):
+        trk = Track(albumartist='album_artist', artist='track_artist')
+        self.assertEqual(trk.artist.name, 'album_artist')
+        trk = Track(artist='track_artist')
+        self.assertEqual(trk.artist.name, 'track_artist')
+
 # vim: ai ts=4 sw=4 sts=4 expandtab