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 six
__version__ = '1.6.0'
__version__ = '1.6.1'
__author__ = 'Amr Hassan, hugovk'
__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2016 hugovk"
__license__ = "apache2"
@ -1918,9 +1918,12 @@ class Album(_Opus):
"""An album."""
__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)
if url:
self.cover_url = url
def get_release_date(self):
"""Returns the release date of the album."""
@ -1937,7 +1940,9 @@ class Album(_Opus):
COVER_MEDIUM
COVER_SMALL
"""
if self.cover_url:
return self.cover_url
else:
return _extract_all(
self._request(
self.ws_prefix + ".getInfo", cacheable=True), 'image')[size]
@ -4243,8 +4248,9 @@ def _extract_top_albums(doc, network):
name = _extract(node, "name")
artist = _extract(node, "name", 1)
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

View file

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