From 88619b30d4b778586015c82d26541246ac0f272b Mon Sep 17 00:00:00 2001 From: Paddez Date: Mon, 7 Nov 2016 13:18:02 +0000 Subject: [PATCH] Edit to allow URL to be saved --- pylast/__init__.py | 17 +++++++++++------ setup.py | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pylast/__init__.py b/pylast/__init__.py index 88039dd..e6c4e85 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1833,9 +1833,12 @@ class Album(_Opus): """An album.""" __hash__ = _Opus.__hash__ - - def __init__(self, artist, title, network, username=None): + cover_image = None + + def __init__(self, artist, title, network, username=None, url=None): super(Album, self).__init__(artist, title, network, "album", username) + if url: + self.cover_image = url def get_release_date(self): """Returns the release date of the album.""" @@ -1852,10 +1855,12 @@ class Album(_Opus): COVER_MEDIUM COVER_SMALL """ - - return _extract_all( - self._request( - self.ws_prefix + ".getInfo", cacheable=True), 'image')[size] + if self.cover_image: + return self.cover_image + else: + return _extract_all( + self._request( + self.ws_prefix + ".getInfo", cacheable=True), 'image')[size] def get_tracks(self): """Returns the list of Tracks on this album.""" diff --git a/setup.py b/setup.py index 1e99522..fcd4e1a 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup, find_packages setup( name="pylast", - version="1.6.0", + version="1.6.1", author="Amr Hassan ", install_requires=['six'], tests_require=['mock', 'pytest', 'coverage', 'pep8', 'pyyaml', 'pyflakes'],