add images url on get next page

This commit is contained in:
zinootje 2018-04-14 19:43:47 +02:00
parent a144ce407d
commit c2dfe04e17

View file

@ -1369,7 +1369,7 @@ class _Opus(_BaseObject, _Taggable):
__hash__ = _BaseObject.__hash__ __hash__ = _BaseObject.__hash__
def __init__(self, artist, title, network, ws_prefix, username=None): def __init__(self, artist, title, network, ws_prefix, username=None, images=None):
""" """
Create an opus instance. Create an opus instance.
# Parameters: # Parameters:
@ -1388,6 +1388,7 @@ class _Opus(_BaseObject, _Taggable):
self.title = title self.title = title
self.username = username self.username = username
self.images = images
def __repr__(self): def __repr__(self):
return "pylast.%s(%s, %s, %s)" % ( return "pylast.%s(%s, %s, %s)" % (
@ -1485,8 +1486,8 @@ class Album(_Opus):
__hash__ = _Opus.__hash__ __hash__ = _Opus.__hash__
def __init__(self, artist, title, network, username=None): def __init__(self, artist, title, network, username=None, images=None):
super(Album, self).__init__(artist, title, network, "album", username) super(Album, self).__init__(artist, title, network, "album", username, images)
def get_cover_image(self, size=SIZE_EXTRA_LARGE): def get_cover_image(self, size=SIZE_EXTRA_LARGE):
""" """
@ -1497,10 +1498,12 @@ class Album(_Opus):
SIZE_MEDIUM SIZE_MEDIUM
SIZE_SMALL SIZE_SMALL
""" """
if not self.images:
return _extract_all( return _extract_all(
self._request( self._request(
self.ws_prefix + ".getInfo", cacheable=True), 'image')[size] self.ws_prefix + ".getInfo", cacheable=True), 'image')[size]
else:
return self.images[size]
def get_tracks(self): def get_tracks(self):
"""Returns the list of Tracks on this album.""" """Returns the list of Tracks on this album."""
@ -2544,7 +2547,8 @@ class AlbumSearch(_Search):
seq.append(Album( seq.append(Album(
_extract(node, "artist"), _extract(node, "artist"),
_extract(node, "name"), _extract(node, "name"),
self.network)) self.network,
images=_extract_all(node, 'image')))
return seq return seq