Skip to content

Commit

Permalink
Let the jukebox crash naturally on uncaught exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jodal committed Mar 4, 2012
1 parent ed21614 commit 5877ab7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions examples/jukebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
import sys
import cmd
import time
import traceback
import threading

from spotify import ArtistBrowser, Link, ToplistBrowser
from spotify.audiosink import import_audio_sink
from spotify.manager import (SpotifySessionManager, SpotifyPlaylistManager,
SpotifyContainerManager)
SpotifyContainerManager)

AudioSink = import_audio_sink()
container_loaded = threading.Event()
Expand All @@ -31,10 +30,8 @@ def run(self):
container_loaded.clear()
try:
self.cmdloop()
except Exception, e:
import traceback
traceback.print_exc(e)
self.do_quit(None)
finally:
self.do_quit(None)

def do_logout(self, line):
self.jukebox.session.logout()
Expand Down Expand Up @@ -314,13 +311,10 @@ def logged_in(self, session, error):
print error
return
self.session = session
try:
self.ctr = session.playlist_container()
self.container_manager.watch(self.ctr)
self.starred = session.starred()
self.ui.start()
except:
traceback.print_exc()
self.ctr = session.playlist_container()
self.container_manager.watch(self.ctr)
self.starred = session.starred()
self.ui.start()

def logged_out(self, session):
self.ui.cmdqueue.append("quit")
Expand Down

0 comments on commit 5877ab7

Please sign in to comment.