Skip to content

Commit

Permalink
stub out 'tagtypes' subcommands (#50)
Browse files Browse the repository at this point in the history
Minimal work to make mpc(1)'s ls command work again.
  • Loading branch information
girst committed Jan 11, 2022
1 parent 17df1a9 commit a8c4deb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mopidy_mpd/protocol/reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ def notcommands(context):


@protocol.commands.add("tagtypes")
def tagtypes(context):
def tagtypes(context, *parameters):
"""
*musicpd.org, reflection section:*
``tagtypes``
``tagtypes [ALL | CLEAR | DISABLE {NAME...] | ENABLE {NAME...]]``
Shows a list of available song metadata.
"""
parameters = list(parameters)
if parameters:
subcommand = parameters.pop(0).lower()
if subcommand not in ("all", "clear", "disable", "enable"):
raise exceptions.MpdArgError("Unknown sub command")
# TODO: this is only a stub; we always return all tags anyhow.
return
return [("tagtype", tagtype) for tagtype in tagtype_list.TAGTYPE_LIST]


Expand Down
20 changes: 20 additions & 0 deletions tests/protocol/test_reflection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@ def test_tagtypes(self):
self.assertInResponse("tagtype: MUSICBRAINZ_TRACKID")
self.assertInResponse("OK")

def test_tagtypes_clear(self):
self.send_request("tagtypes clear")
self.assertInResponse("OK")

def test_tagtypes_all(self):
self.send_request("tagtypes all")
self.assertInResponse("OK")

def test_tagtypes_disable(self):
self.send_request("tagtypes disable x")
self.assertInResponse("OK")

def test_tagtypes_enable(self):
self.send_request("tagtypes enable x")
self.assertInResponse("OK")

def test_tagtypes_bogus(self):
self.send_request("tagtypes bogus")
self.assertEqualResponse("ACK [2@0] {tagtypes} Unknown sub command")

def test_urlhandlers(self):
self.send_request("urlhandlers")
self.assertInResponse("OK")
Expand Down

0 comments on commit a8c4deb

Please sign in to comment.