Fix use of threading.Event for Python 2.6 and clear connected state.
threading.Event's wait method returns None on python pre 2.7, which means all searches would fail. This also corrects that fact that we weren't clearing the connected threading event on disconnects. I did not add any tests for this at this time as I just want to get the fix out.
This commit is contained in:
parent
81b9d1116d
commit
3a4a9e60e0
@ -163,7 +163,9 @@ class SpotifyLibraryProvider(base.BaseLibraryProvider):
|
||||
translator.to_mopidy_track(t) for t in results.tracks()])
|
||||
future.set(search_result)
|
||||
|
||||
if not self.backend.spotify.connected.wait(settings.SPOTIFY_TIMEOUT):
|
||||
# Wait always returns None on python 2.6 :/
|
||||
self.backend.spotify.connected.wait(settings.SPOTIFY_TIMEOUT)
|
||||
if not self.backend.spotify.connected.is_set():
|
||||
logger.debug('Not connected: Spotify search cancelled')
|
||||
return SearchResult(uri='spotify:search')
|
||||
|
||||
|
||||
@ -84,6 +84,7 @@ class SpotifySessionManager(process.BaseThread, PyspotifySessionManager):
|
||||
def logged_out(self, session):
|
||||
"""Callback used by pyspotify"""
|
||||
logger.info('Disconnected from Spotify')
|
||||
self.connected.clear()
|
||||
|
||||
def metadata_updated(self, session):
|
||||
"""Callback used by pyspotify"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user