Merge branch 'master' into gstreamer

This commit is contained in:
Stein Magnus Jodal 2010-08-13 13:09:21 +02:00
commit d96192dd98
5 changed files with 24 additions and 2 deletions

View File

@ -25,6 +25,8 @@ Another great release.
- Fixed ``play "-1"`` and ``playid "-1"`` behaviour when playlist is empty.
- 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:

View File

@ -257,6 +257,7 @@ def playlistsearch(frontend, tag, needle):
"""
raise MpdNotImplemented # TODO
@handle_pattern(r'^plchanges (?P<version>-?\d+)$')
@handle_pattern(r'^plchanges "(?P<version>-?\d+)"$')
def plchanges(frontend, version):
"""

View File

@ -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:

View File

@ -330,6 +330,15 @@ class CurrentPlaylistHandlerTest(unittest.TestCase):
self.assert_(u'Title: c' in result)
self.assert_(u'OK' in result)
def test_plchanges_without_quotes_works(self):
self.b.current_playlist.load(
[Track(name='a'), Track(name='b'), Track(name='c')])
result = self.h.handle_request(u'plchanges 0')
self.assert_(u'Title: a' in result)
self.assert_(u'Title: b' in result)
self.assert_(u'Title: c' in result)
self.assert_(u'OK' in result)
def test_plchangesposid(self):
self.b.current_playlist.load([Track(), Track(), Track()])
result = self.h.handle_request(u'plchangesposid "0"')

View File

@ -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"')