From a3446621f465ee3e0b8ef630c9239536ae9b264a Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Mon, 24 Dec 2012 13:55:46 +0100 Subject: [PATCH 1/2] 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. --- mopidy/backends/spotify/library.py | 4 +++- mopidy/backends/spotify/session_manager.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mopidy/backends/spotify/library.py b/mopidy/backends/spotify/library.py index a8a9bcd6..96e5f616 100644 --- a/mopidy/backends/spotify/library.py +++ b/mopidy/backends/spotify/library.py @@ -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') diff --git a/mopidy/backends/spotify/session_manager.py b/mopidy/backends/spotify/session_manager.py index f2631406..8326d7b4 100644 --- a/mopidy/backends/spotify/session_manager.py +++ b/mopidy/backends/spotify/session_manager.py @@ -83,6 +83,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""" From c37ce8751e38c851ed7b71f7927c0e42132d7d8e Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 24 Dec 2012 20:23:51 +0100 Subject: [PATCH 2/2] Release v0.11.1 --- docs/changes.rst | 7 +++++++ mopidy/__init__.py | 2 +- tests/version_test.py | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/changes.rst b/docs/changes.rst index e705444b..296e7e38 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -5,6 +5,13 @@ Changes This change log is used to track all major changes to Mopidy. +v0.11.1 (2012-12-24) +==================== + +Spotify search was broken in 0.11.0 for users of Python 2.6. This release fixes +it. If you're using Python 2.7, v0.11.0 and v0.11.1 should be equivalent. + + v0.11.0 (2012-12-24) ==================== diff --git a/mopidy/__init__.py b/mopidy/__init__.py index 2e5aeeba..9d66b722 100644 --- a/mopidy/__init__.py +++ b/mopidy/__init__.py @@ -23,7 +23,7 @@ if (isinstance(pykka.__version__, basestring) warnings.filterwarnings('ignore', 'could not open display') -__version__ = '0.11.0' +__version__ = '0.11.1' from mopidy import settings as default_settings_module diff --git a/tests/version_test.py b/tests/version_test.py index f353f201..1cb3967c 100644 --- a/tests/version_test.py +++ b/tests/version_test.py @@ -33,5 +33,6 @@ class VersionTest(unittest.TestCase): self.assertLess(SV('0.8.0'), SV('0.8.1')) self.assertLess(SV('0.8.1'), SV('0.9.0')) self.assertLess(SV('0.9.0'), SV('0.10.0')) - self.assertLess(SV('0.10.0'), SV(__version__)) - self.assertLess(SV(__version__), SV('0.11.1')) + self.assertLess(SV('0.10.0'), SV('0.11.0')) + self.assertLess(SV('0.11.0'), SV(__version__)) + self.assertLess(SV(__version__), SV('0.11.2'))