Check if album is loaded before use
This commit is contained in:
parent
4cc7b87669
commit
088f3e8505
@ -31,9 +31,10 @@ class SpotifyTranslator(object):
|
|||||||
uri = str(Link.from_track(spotify_track, 0))
|
uri = str(Link.from_track(spotify_track, 0))
|
||||||
if not spotify_track.is_loaded():
|
if not spotify_track.is_loaded():
|
||||||
return Track(uri=uri, name=u'[loading...]')
|
return Track(uri=uri, name=u'[loading...]')
|
||||||
if (spotify_track.album() is not None and
|
spotify_album = spotify_track.album()
|
||||||
dt.MINYEAR <= int(spotify_track.album().year()) <= dt.MAXYEAR):
|
if (spotify_album is not None and spotify_album.is_loaded()
|
||||||
date = dt.date(spotify_track.album().year(), 1, 1)
|
and dt.MINYEAR <= int(spotify_album.year()) <= dt.MAXYEAR):
|
||||||
|
date = dt.date(spotify_album.year(), 1, 1)
|
||||||
else:
|
else:
|
||||||
date = None
|
date = None
|
||||||
return Track(
|
return Track(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user