Edit to allow URL to be saved

This commit is contained in:
Paddez 2016-11-07 13:18:02 +00:00
parent 54c4f9c093
commit 88619b30d4
No known key found for this signature in database
GPG key ID: 1DB178216DA02CD1
2 changed files with 12 additions and 7 deletions

View file

@ -1833,9 +1833,12 @@ class Album(_Opus):
"""An album.""" """An album."""
__hash__ = _Opus.__hash__ __hash__ = _Opus.__hash__
cover_image = 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_image = 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."""
@ -1852,10 +1855,12 @@ class Album(_Opus):
COVER_MEDIUM COVER_MEDIUM
COVER_SMALL COVER_SMALL
""" """
if self.cover_image:
return _extract_all( return self.cover_image
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."""

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'],
tests_require=['mock', 'pytest', 'coverage', 'pep8', 'pyyaml', 'pyflakes'], tests_require=['mock', 'pytest', 'coverage', 'pep8', 'pyyaml', 'pyflakes'],