Store Album Art URLs when you call GetTopAlbums.
GetTopAlbums returns AlbumArt information alongside the TopAlbums. We should store this in the Album() info variable, so we don't have to follow up with an additional GetInfo() call if we want the Album Art. Signed-off-by: Paddez <dave@paddez.com>
This commit is contained in:
parent
46e4c0ec4c
commit
7694de346e
|
@ -2896,8 +2896,9 @@ def _extract_top_albums(doc, network):
|
||||||
name = _extract(node, "name")
|
name = _extract(node, "name")
|
||||||
artist = _extract(node, "name", 1)
|
artist = _extract(node, "name", 1)
|
||||||
playcount = _extract(node, "playcount")
|
playcount = _extract(node, "playcount")
|
||||||
|
info = {"image": _extract_all(node, "image")}
|
||||||
|
|
||||||
seq.append(TopItem(Album(artist, name, network), playcount))
|
seq.append(TopItem(Album(artist, name, network, info=info), playcount))
|
||||||
|
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
|
|
|
@ -271,6 +271,12 @@ class TestPyLastUser(TestPyLastWithLastFm):
|
||||||
# Assert
|
# Assert
|
||||||
self.helper_only_one_thing_in_top_list(albums, pylast.Album)
|
self.helper_only_one_thing_in_top_list(albums, pylast.Album)
|
||||||
|
|
||||||
|
top_album = albums[0].item
|
||||||
|
self.assertTrue(len(top_album.info["image"]))
|
||||||
|
self.assertRegexpMatches(
|
||||||
|
top_album.info["image"][pylast.SIZE_LARGE], r"^http.+$"
|
||||||
|
)
|
||||||
|
|
||||||
def test_user_tagged_artists(self):
|
def test_user_tagged_artists(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
lastfm_user = self.network.get_user(self.username)
|
lastfm_user = self.network.get_user(self.username)
|
||||||
|
|
Loading…
Reference in a new issue