MPD: Support 'play' without quotes to work with BitMPC
This commit is contained in:
parent
5393407571
commit
9f71c1533a
@ -26,6 +26,7 @@ Another great release.
|
||||
- Support ``plchanges "-1"`` to work better with MPDroid.
|
||||
- Support ``pause`` without arguments to work better with MPDroid.
|
||||
- Support ``plchanges`` without quotes to work better with BitMPC.
|
||||
- Support ``play`` without quotes to work better with BitMPC.
|
||||
|
||||
- Backend API:
|
||||
|
||||
|
||||
@ -147,8 +147,8 @@ def playid(frontend, cpid):
|
||||
except LookupError:
|
||||
raise MpdNoExistError(u'No such song', command=u'playid')
|
||||
|
||||
@handle_pattern(r'^play "(?P<songpos>\d+)"$')
|
||||
@handle_pattern(r'^play "(?P<songpos>-1)"$')
|
||||
@handle_pattern(r'^play (?P<songpos>-?\d+)$')
|
||||
@handle_pattern(r'^play "(?P<songpos>-?\d+)"$')
|
||||
def playpos(frontend, songpos):
|
||||
"""
|
||||
*musicpd.org, playback section:*
|
||||
@ -161,6 +161,10 @@ def playpos(frontend, songpos):
|
||||
|
||||
- issues ``play "-1"`` after playlist replacement to start playback at
|
||||
the first track.
|
||||
|
||||
*BitMPC:*
|
||||
|
||||
- issues ``play 6`` without quotes around the argument.
|
||||
"""
|
||||
songpos = int(songpos)
|
||||
try:
|
||||
|
||||
@ -175,6 +175,12 @@ class PlaybackControlHandlerTest(unittest.TestCase):
|
||||
self.assert_(u'OK' in result)
|
||||
self.assertEqual(self.b.playback.PLAYING, self.b.playback.state)
|
||||
|
||||
def test_play_with_pos_without_quotes(self):
|
||||
self.b.current_playlist.load([Track()])
|
||||
result = self.h.handle_request(u'play 0')
|
||||
self.assert_(u'OK' in result)
|
||||
self.assertEqual(self.b.playback.PLAYING, self.b.playback.state)
|
||||
|
||||
def test_play_with_pos_out_of_bounds(self):
|
||||
self.b.current_playlist.load([])
|
||||
result = self.h.handle_request(u'play "0"')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user