Implement pause on the libspotify backend by seeking to the resume position

This commit is contained in:
Stein Magnus Jodal 2010-08-14 03:29:34 +02:00
parent 1db7b84fe6
commit 250168ebba
2 changed files with 4 additions and 2 deletions

View File

@ -40,12 +40,13 @@ class LibspotifyPlaybackController(BasePlaybackController):
return False
def _resume(self):
return self._set_output_state('PLAYING')
return self._seek(self.time_position)
def _seek(self, time_position):
self._set_output_state('READY')
result = self.backend.spotify.session.seek(time_position)
self.backend.spotify.session.seek(time_position)
self._set_output_state('PLAYING')
return True
def _stop(self):
result = self._set_output_state('READY')

View File

@ -156,6 +156,7 @@ class GStreamerProcess(BaseProcess):
:type state_name: string
:rtype: :class:`True` or :class:`False`
"""
# XXX Setting state to PLAYING often returns False even if it works
result = self.gst_pipeline.set_state(
getattr(gst, 'STATE_' + state_name))
if result == gst.STATE_CHANGE_SUCCESS: