User.get_now_playing: Add album and cover image to info

This commit is contained in:
Hugo 2020-06-01 14:52:29 +03:00
parent 898a8b5756
commit 7689a1e95a
2 changed files with 6 additions and 1 deletions

View file

@ -2338,8 +2338,9 @@ class User(_BaseObject, _Chartable):
artist = _extract(e, "artist")
title = _extract(e, "name")
info = {"album": _extract(e, "album"), "image": _extract_all(e, "image")}
return Track(artist, title, self.network, self.name)
return Track(artist, title, self.network, self.name, info=info)
def get_recent_tracks(self, limit=10, cacheable=True, time_from=None, time_to=None):
"""

View file

@ -47,6 +47,10 @@ class TestPyLastNetwork(TestPyLastWithLastFm):
self.assertIsNotNone(current_track)
self.assertEqual(str(current_track.title).lower(), "test title")
self.assertEqual(str(current_track.artist).lower(), "test artist")
self.assertEqual(current_track.info["album"], "Test Album")
self.assertTrue(len(current_track.info["image"]))
self.assertRegex(current_track.info["image"][pylast.SIZE_LARGE], r"^http.+$")
def test_enable_rate_limiting(self):
# Arrange