spotify: SpotifyTrack fails when both uri and track is provided

This commit is contained in:
Stein Magnus Jodal 2012-12-20 18:59:01 +01:00
parent 4d67dd1353
commit 42faec8a3c

View File

@ -19,12 +19,12 @@ class SpotifyTrack(Track):
"""Proxy object for unloaded Spotify tracks."""
def __init__(self, uri=None, track=None):
super(SpotifyTrack, self).__init__()
if uri:
if (uri and track) or (not uri and not track):
raise AttributeError('uri or track must be provided')
elif uri:
self._spotify_track = Link.from_string(uri).as_track()
elif track:
self._spotify_track = track
else:
raise AttributeError('uri or track must be provided')
self._unloaded_track = Track(uri=uri, name='[loading...]')
self._track = None