Merge branch 'master' into cpc

This commit is contained in:
Stein Magnus Jodal 2010-06-30 12:45:01 +02:00
commit 81503df2ad
3 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,8 @@ We got an updated :doc:`release roadmap <development/roadmap>`!
as unknown commands.
- ``command_list_end`` before ``command_list_start`` now returns unknown
command error instead of crashing.
- ``list`` accepts field argument without quotes and capitalized, to work
with GMPC and ncmpc.
- Backend API:

View File

@ -637,7 +637,9 @@ class MpdFrontend(object):
# TODO Add result to current playlist
#return result
@handle_pattern(r'^list (?P<field>[Aa]rtist)$')
@handle_pattern(r'^list "(?P<field>[Aa]rtist)"$')
@handle_pattern(r'^list (?P<field>album)( "(?P<artist>[^"]+)")*$')
@handle_pattern(r'^list "(?P<field>album)"( "(?P<artist>[^"]+)")*$')
def _music_db_list(self, field, artist=None):
"""
@ -651,6 +653,10 @@ class MpdFrontend(object):
``ARTIST`` is an optional parameter when type is ``album``, this
specifies to list albums by an artist.
*GMPC:*
- does not add quotes around the field argument.
*ncmpc:*
- does not add quotes around the field argument.

View File

@ -1010,6 +1010,14 @@ class MusicDatabaseHandlerTest(unittest.TestCase):
result = self.h.handle_request(u'list "artist"')
self.assert_(u'OK' in result)
def test_list_artist_without_quotes(self):
result = self.h.handle_request(u'list artist')
self.assert_(u'OK' in result)
def test_list_artist_without_quotes_and_capitalized(self):
result = self.h.handle_request(u'list Artist')
self.assert_(u'OK' in result)
def test_list_artist_with_artist_should_fail(self):
result = self.h.handle_request(u'list "artist" "anartist"')
self.assertEqual(result[0], u'ACK [2@0] {list} incorrect arguments')