From: kaliko Date: Tue, 18 Nov 2014 22:29:17 +0000 (+0100) Subject: Use albumartist to fetch similar artists X-Git-Tag: 0.12.3~9 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=a6a2ea116e050cd0f1c3f81a392878bcd22a5960;p=mpd-sima.git Use albumartist to fetch similar artists --- diff --git a/doc/Changelog b/doc/Changelog index 02dee06..72abd9f 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,10 @@ +MPD_sima v0.12.3 UNRELEASED + + * Use albumartist to fetch similar artists + +-- kaliko jack UNRELEASED + + MPD_sima v0.12.2 * Add some randomness to track selection diff --git a/sima/lib/track.py b/sima/lib/track.py index a938c27..55fb367 100644 --- a/sima/lib/track.py +++ b/sima/lib/track.py @@ -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 diff --git a/sima/lib/webserv.py b/sima/lib/webserv.py index 4a048e9..f1afd55 100644 --- a/sima/lib/webserv.py +++ b/sima/lib/webserv.py @@ -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)) diff --git a/tests/test_track.py b/tests/test_track.py index 1287784..e838a20 100644 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -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