From f312d79261c12ab7fe7825bbcec97e4f308a67c1 Mon Sep 17 00:00:00 2001 From: Johannes Knutsen Date: Sat, 14 Aug 2010 01:21:16 +0200 Subject: [PATCH] implemented libspotify seek --- mopidy/backends/libspotify/__init__.py | 6 +++++- mopidy/frontends/mpd/protocol/playback.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mopidy/backends/libspotify/__init__.py b/mopidy/backends/libspotify/__init__.py index 974e52df..5e99385e 100644 --- a/mopidy/backends/libspotify/__init__.py +++ b/mopidy/backends/libspotify/__init__.py @@ -122,7 +122,11 @@ class LibspotifyPlaybackController(BasePlaybackController): return self._set_output_state('PLAYING') def _seek(self, time_position): - pass # TODO + self._set_output_state('READY') + seek_to_ms = int(time_position) * 1000 + result = self.backend.spotify.session.seek(seek_to_ms) + self._set_output_state('PLAYING') + return True def _stop(self): result = self._set_output_state('READY') diff --git a/mopidy/frontends/mpd/protocol/playback.py b/mopidy/frontends/mpd/protocol/playback.py index cf803c6d..7fe42ec8 100644 --- a/mopidy/frontends/mpd/protocol/playback.py +++ b/mopidy/frontends/mpd/protocol/playback.py @@ -293,7 +293,7 @@ def seek(frontend, songpos, seconds): Seeks to the position ``TIME`` (in seconds) of entry ``SONGPOS`` in the playlist. """ - raise MpdNotImplemented # TODO + return frontend.backend.playback._seek(seconds) @handle_pattern(r'^seekid "(?P\d+)" "(?P\d+)"$') def seekid(frontend, cpid, seconds):