diff --git a/mopidy/mpd/frontend.py b/mopidy/mpd/frontend.py index 160462c3..c92346eb 100644 --- a/mopidy/mpd/frontend.py +++ b/mopidy/mpd/frontend.py @@ -1107,7 +1107,20 @@ class MpdFrontend(object): As permissions is not implemented, any user has access to all commands. """ - return [('command', c) for c in sorted(list(_commands))] + commands = sorted(list(_commands)) + + # Added by Mopidy. Not a part of the MPD protocol. + commands.remove('ack') + + # Not shown by MPD in its command list + commands.remove('command_list_begin') + commands.remove('command_list_ok_begin') + commands.remove('command_list_end') + commands.remove('idle') + commands.remove('noidle') + commands.remove('sticker') + + return [('command', c) for c in commands] @handle_pattern(r'^decoders$') def _reflection_decoders(self): diff --git a/tests/mpd/frontend_test.py b/tests/mpd/frontend_test.py index a77a30b1..d884ab73 100644 --- a/tests/mpd/frontend_test.py +++ b/tests/mpd/frontend_test.py @@ -1186,9 +1186,18 @@ class ReflectionHandlerTest(unittest.TestCase): def test_commands_returns_list_of_all_commands(self): result = self.h.handle_request(u'commands') + # Check if some random commands are included self.assert_(u'command: commands' in result) self.assert_(u'command: play' in result) self.assert_(u'command: status' in result) + # Check if the blacklisted commands are not present + self.assert_(u'command: ack' not in result) + self.assert_(u'command: command_list_begin' not in result) + self.assert_(u'command: command_list_ok_begin' not in result) + self.assert_(u'command: command_list_end' not in result) + self.assert_(u'command: idle' not in result) + self.assert_(u'command: noidle' not in result) + self.assert_(u'command: sticker' not in result) self.assert_(u'OK' in result) def test_decoders(self):