This commit is contained in:
David K 2016-11-07 14:25:01 +00:00 committed by GitHub
commit 46b79d0db7
2 changed files with 15 additions and 9 deletions

View file

@ -32,7 +32,7 @@ import warnings
import re import re
import six import six
__version__ = '1.6.0' __version__ = '1.6.1'
__author__ = 'Amr Hassan, hugovk' __author__ = 'Amr Hassan, hugovk'
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2016 hugovk" __copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2016 hugovk"
__license__ = "apache2" __license__ = "apache2"
@ -1918,9 +1918,12 @@ class Album(_Opus):
"""An album.""" """An album."""
__hash__ = _Opus.__hash__ __hash__ = _Opus.__hash__
cover_url = None
def __init__(self, artist, title, network, username=None): def __init__(self, artist, title, network, username=None, url=None):
super(Album, self).__init__(artist, title, network, "album", username) super(Album, self).__init__(artist, title, network, "album", username)
if url:
self.cover_url = url
def get_release_date(self): def get_release_date(self):
"""Returns the release date of the album.""" """Returns the release date of the album."""
@ -1937,10 +1940,12 @@ class Album(_Opus):
COVER_MEDIUM COVER_MEDIUM
COVER_SMALL COVER_SMALL
""" """
if self.cover_url:
return _extract_all( return self.cover_url
self._request( else:
self.ws_prefix + ".getInfo", cacheable=True), 'image')[size] return _extract_all(
self._request(
self.ws_prefix + ".getInfo", cacheable=True), 'image')[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."""
@ -4243,8 +4248,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")
cover_url = _extract_all(node, "image")[COVER_EXTRA_LARGE]
seq.append(TopItem(Album(artist, name, network), playcount)) seq.append(TopItem(Album(artist, name, network, url=cover_url), playcount))
return seq return seq

View file

@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup( setup(
name="pylast", name="pylast",
version="1.6.0", version="1.6.1",
author="Amr Hassan <amr.hassan@gmail.com>", author="Amr Hassan <amr.hassan@gmail.com>",
install_requires=['six'], install_requires=['six'],
# FIXME This can be removed after 2017-09 when 3.3 is no longer supported # FIXME This can be removed after 2017-09 when 3.3 is no longer supported