Move test code out of metadata_updated()
This commit is contained in:
parent
ac3bee0799
commit
a0426c702d
@ -33,23 +33,6 @@ class LibspotifySession(SpotifySessionManager, threading.Thread):
|
||||
def metadata_updated(self, session):
|
||||
logger.debug('Metadata updated')
|
||||
|
||||
# XXX This should play the first song in your first playlist :-)
|
||||
playlist_no = 0
|
||||
track_no = 0
|
||||
try:
|
||||
if not self.queued:
|
||||
if len(self.playlists) > playlist_no:
|
||||
playlist = self.playlists[playlist_no]
|
||||
if playlist.is_loaded():
|
||||
if playlist[track_no].is_loaded():
|
||||
session.load(playlist[track_no])
|
||||
session.play(1)
|
||||
self.queued = True
|
||||
logger.info('Playing "%s"',
|
||||
playlist[track_no].name())
|
||||
except Exception, e:
|
||||
logger.exception(e)
|
||||
|
||||
def connection_error(self, session, error):
|
||||
logger.error('Connection error: %s', error)
|
||||
|
||||
@ -71,6 +54,25 @@ class LibspotifySession(SpotifySessionManager, threading.Thread):
|
||||
def end_of_track(self, session):
|
||||
logger.debug('End of track')
|
||||
|
||||
def test(self):
|
||||
# XXX This should play the first song in your first playlist :-)
|
||||
playlist_no = 0
|
||||
track_no = 0
|
||||
try:
|
||||
if not self.queued:
|
||||
if len(self.playlists) > playlist_no:
|
||||
playlist = self.playlists[playlist_no]
|
||||
if playlist.is_loaded():
|
||||
if playlist[track_no].is_loaded():
|
||||
session.load(playlist[track_no])
|
||||
session.play(1)
|
||||
self.queued = True
|
||||
logger.info('Playing "%s"',
|
||||
playlist[track_no].name())
|
||||
except Exception, e:
|
||||
logger.exception(e)
|
||||
|
||||
|
||||
class LibspotifyBackend(BaseBackend):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.spotify = LibspotifySession(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user