From 9af4290f456893d145e1fb1a5a718d9ff6d829a1 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sun, 1 Sep 2013 23:14:30 +0200 Subject: [PATCH] mpd: Accept listall and listallinfo without the URI argument --- docs/changelog.rst | 10 +++++++--- mopidy/frontends/mpd/protocol/music_db.py | 10 ++++++---- tests/frontends/mpd/protocol/music_db_test.py | 12 ++++++++++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index e3b94b58..1b08a742 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -42,9 +42,9 @@ v0.15.0 (UNRELEASED) to start providing their own custom libraries instead of being stuck with just our tag cache as the only option. -- Converted local backend to use new `local:playlist:path` and - `local:track:path` uri scheme. Also moves support of `file://` to streaming - backend. +- Converted local backend to use new ``local:playlist:path`` and + ``local:track:path`` URI scheme. Also moves support of ``file://`` to + streaming backend. **Spotify backend** @@ -60,6 +60,10 @@ v0.15.0 (UNRELEASED) - Replace newline, carriage return and forward slash in playlist names. (Fixes: :issue:`474`, :issue:`480`) +- Accept ``listall`` and ``listallinfo`` commands without the URI parameter. + The methods are still not implemented, but now the commands are accepted as + valid. + v0.14.2 (2013-07-01) ==================== diff --git a/mopidy/frontends/mpd/protocol/music_db.py b/mopidy/frontends/mpd/protocol/music_db.py index 8e31dbf8..f81d57ee 100644 --- a/mopidy/frontends/mpd/protocol/music_db.py +++ b/mopidy/frontends/mpd/protocol/music_db.py @@ -245,8 +245,9 @@ def _list_date(context, query): return dates -@handle_request(r'^listall "(?P[^"]+)"') -def listall(context, uri): +@handle_request(r'^listall$') +@handle_request(r'^listall "(?P[^"]+)"$') +def listall(context, uri=None): """ *musicpd.org, music database section:* @@ -257,8 +258,9 @@ def listall(context, uri): raise MpdNotImplemented # TODO -@handle_request(r'^listallinfo "(?P[^"]+)"') -def listallinfo(context, uri): +@handle_request(r'^listallinfo$') +@handle_request(r'^listallinfo "(?P[^"]+)"$') +def listallinfo(context, uri=None): """ *musicpd.org, music database section:* diff --git a/tests/frontends/mpd/protocol/music_db_test.py b/tests/frontends/mpd/protocol/music_db_test.py index fa909bab..21c6721f 100644 --- a/tests/frontends/mpd/protocol/music_db_test.py +++ b/tests/frontends/mpd/protocol/music_db_test.py @@ -82,11 +82,19 @@ class MusicDatabaseHandlerTest(protocol.BaseTestCase): self.assertEqual(playlists[0].tracks[0].uri, 'dummy:a') self.assertInResponse('OK') - def test_listall(self): + def test_listall_without_uri(self): + self.sendRequest('listall') + self.assertEqualResponse('ACK [0@0] {} Not implemented') + + def test_listall_with_uri(self): self.sendRequest('listall "file:///dev/urandom"') self.assertEqualResponse('ACK [0@0] {} Not implemented') - def test_listallinfo(self): + def test_listallinfo_without_uri(self): + self.sendRequest('listallinfo') + self.assertEqualResponse('ACK [0@0] {} Not implemented') + + def test_listallinfo_with_uri(self): self.sendRequest('listallinfo "file:///dev/urandom"') self.assertEqualResponse('ACK [0@0] {} Not implemented')