Fix seek for Droid MPD
This commit is contained in:
parent
469e5fa189
commit
3eb1d47765
@ -58,6 +58,8 @@ No description yet.
|
||||
|
||||
- Support ``setvol 50`` without quotes around the argument. Fixes volume
|
||||
control in Droid MPD.
|
||||
- Support ``seek 1 120`` without quotes around the arguments. Fixes seek in
|
||||
Droid MPD.
|
||||
|
||||
- Local backend:
|
||||
|
||||
|
||||
@ -293,6 +293,7 @@ def replay_gain_status(frontend):
|
||||
"""
|
||||
return u'off' # TODO
|
||||
|
||||
@handle_pattern(r'^seek (?P<songpos>\d+) (?P<seconds>\d+)$')
|
||||
@handle_pattern(r'^seek "(?P<songpos>\d+)" "(?P<seconds>\d+)"$')
|
||||
def seek(frontend, songpos, seconds):
|
||||
"""
|
||||
@ -302,6 +303,10 @@ def seek(frontend, songpos, seconds):
|
||||
|
||||
Seeks to the position ``TIME`` (in seconds) of entry ``SONGPOS`` in
|
||||
the playlist.
|
||||
|
||||
*Droid MPD:*
|
||||
|
||||
- issues ``seek 1 120`` without quotes around the arguments.
|
||||
"""
|
||||
if frontend.backend.playback.current_playlist_position != songpos:
|
||||
playpos(frontend, songpos)
|
||||
|
||||
@ -325,6 +325,13 @@ class PlaybackControlHandlerTest(unittest.TestCase):
|
||||
result = self.h.handle_request(u'seek "1" "30"')
|
||||
self.assertEqual(self.b.playback.current_track, seek_track)
|
||||
|
||||
def test_seek_without_quotes(self):
|
||||
self.b.current_playlist.append([Track(length=40000)])
|
||||
self.h.handle_request(u'seek 0')
|
||||
result = self.h.handle_request(u'seek 0 30')
|
||||
self.assert_(u'OK' in result)
|
||||
self.assert_(self.b.playback.time_position >= 30000)
|
||||
|
||||
def test_seekid(self):
|
||||
self.b.current_playlist.append([Track(length=40000)])
|
||||
result = self.h.handle_request(u'seekid "0" "30"')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user