Call correct methods in seek and convert to milliseconds in

frontend
This commit is contained in:
Johannes Knutsen 2010-08-14 02:04:05 +02:00
parent 2d13485a21
commit 9c589352c8
3 changed files with 6 additions and 7 deletions

View File

@ -370,12 +370,13 @@ class BasePlaybackController(object):
self.next()
return
self._play_time_started = self._current_wall_time
self._play_time_accumulated = time_position
self._seek(time_position)
def _seek(self, time_position):
time_position_ms = int(time_position) * 1000
self._play_time_started = (self._current_wall_time - time_position_ms)
self._play_time_accumulated = time_position_ms
raise NotImplementedError
def stop(self):
"""Stop playing."""

View File

@ -123,10 +123,8 @@ class LibspotifyPlaybackController(BasePlaybackController):
def _seek(self, time_position):
self._set_output_state('READY')
seek_to_ms = int(time_position) * 1000
result = self.backend.spotify.session.seek(seek_to_ms)
result = self.backend.spotify.session.seek(time_position)
self._set_output_state('PLAYING')
super(LibspotifyPlaybackController, self)._seek(time_position)
def _stop(self):
result = self._set_output_state('READY')

View File

@ -293,7 +293,7 @@ def seek(frontend, songpos, seconds):
Seeks to the position ``TIME`` (in seconds) of entry ``SONGPOS`` in
the playlist.
"""
return frontend.backend.playback._seek(seconds)
return frontend.backend.playback.seek(int(seconds) * 1000)
@handle_pattern(r'^seekid "(?P<cpid>\d+)" "(?P<seconds>\d+)"$')
def seekid(frontend, cpid, seconds):