spotify: Block track lookups until we get data

This makes track lookup behave consistently with lookup of artists, albums and
playlists. I consider this "safe", since track lookup is only used for lookup
of single tracks by URI. If you're e.g. loading a playlist full of unloaded
tracks, you should still use SpotifyTrack to avoid blocking on track loading.
This commit is contained in:
Stein Magnus Jodal 2012-12-20 19:08:01 +01:00
parent e118c73aa3
commit a3ab956733

View File

@ -80,7 +80,9 @@ class SpotifyLibraryProvider(base.BaseLibraryProvider):
return []
def _lookup_track(self, uri):
return [SpotifyTrack(uri)]
track = Link.from_string(uri).as_track()
self._wait_for_object_to_load(track)
return [SpotifyTrack(track=track)]
def _lookup_album(self, uri):
album = Link.from_string(uri).as_album()