Fix IndexError in libspotify test code
This commit is contained in:
parent
f0599fcf37
commit
ccaba50ddc
@ -34,15 +34,19 @@ class LibspotifySession(SpotifySessionManager, threading.Thread):
|
|||||||
logger.debug('Metadata updated')
|
logger.debug('Metadata updated')
|
||||||
|
|
||||||
# XXX This should play the first song in your first playlist :-)
|
# XXX This should play the first song in your first playlist :-)
|
||||||
|
playlist_no = 0
|
||||||
|
track_no = 0
|
||||||
try:
|
try:
|
||||||
if not self.queued:
|
if not self.queued:
|
||||||
playlist = self.playlists[0]
|
if len(self.playlists) > playlist_no:
|
||||||
if playlist.is_loaded():
|
playlist = self.playlists[playlist_no]
|
||||||
if playlist[0].is_loaded():
|
if playlist.is_loaded():
|
||||||
session.load(playlist[0])
|
if playlist[track_no].is_loaded():
|
||||||
session.play(1)
|
session.load(playlist[track_no])
|
||||||
self.queued = True
|
session.play(1)
|
||||||
logger.info('Playing "%s"', playlist[0].name())
|
self.queued = True
|
||||||
|
logger.info('Playing "%s"',
|
||||||
|
playlist[track_no].name())
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user