From 16518697c8cecbd17e1928493576357d12da19c0 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Tue, 20 Nov 2012 15:08:17 +0100 Subject: [PATCH] spotify: Only pause on connection error if playing Spotify has availability issues today, which makes this easy to reproduce and improve. Before this patch, the following was logged on a Spotify connection error when not playing: ERROR Spotify connection error: Can not connect to Spotify WARNING Setting GStreamer state to GST_STATE_PAUSED failed ERROR Resource not found. gstplaybin2.c(3824): setup_next_source (): /GstPlayBin2:playbin20 With this patch, only the first and relevant error message is logged. --- mopidy/backends/spotify/session_manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mopidy/backends/spotify/session_manager.py b/mopidy/backends/spotify/session_manager.py index 00d45e19..cfe4e433 100644 --- a/mopidy/backends/spotify/session_manager.py +++ b/mopidy/backends/spotify/session_manager.py @@ -10,7 +10,7 @@ import threading from spotify.manager import SpotifySessionManager as PyspotifySessionManager -from mopidy import settings +from mopidy import audio, settings from mopidy.backends.listener import BackendListener from mopidy.utils import process, versioning @@ -92,7 +92,8 @@ class SpotifySessionManager(process.BaseThread, PyspotifySessionManager): logger.info('Spotify connection OK') else: logger.error('Spotify connection error: %s', error) - self.backend.playback.pause() + if self.audio.state.get() == audio.PlaybackState.PLAYING: + self.backend.playback.pause() def message_to_user(self, session, message): """Callback used by pyspotify"""