diff --git a/docs/changes.rst b/docs/changes.rst index a274e37e..50ac4917 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -24,6 +24,8 @@ We got an updated :doc:`release 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: diff --git a/mopidy/mpd/frontend.py b/mopidy/mpd/frontend.py index c687ad66..61b90f08 100644 --- a/mopidy/mpd/frontend.py +++ b/mopidy/mpd/frontend.py @@ -637,7 +637,9 @@ class MpdFrontend(object): # TODO Add result to current playlist #return result + @handle_pattern(r'^list (?P[Aa]rtist)$') @handle_pattern(r'^list "(?P[Aa]rtist)"$') + @handle_pattern(r'^list (?Palbum)( "(?P[^"]+)")*$') @handle_pattern(r'^list "(?Palbum)"( "(?P[^"]+)")*$') 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. diff --git a/tests/mpd/frontend_test.py b/tests/mpd/frontend_test.py index 06af5519..eed657ba 100644 --- a/tests/mpd/frontend_test.py +++ b/tests/mpd/frontend_test.py @@ -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')