mpd: Convert reflection and mark non listed commands
This commit is contained in:
parent
01a62d3ada
commit
45a0a9233c
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from mopidy.mpd import exceptions, protocol
|
||||
|
||||
|
||||
@protocol.commands.add('command_list_begin')
|
||||
@protocol.commands.add('command_list_begin', list_command=False)
|
||||
def command_list_begin(context):
|
||||
"""
|
||||
*musicpd.org, command list section:*
|
||||
@ -25,7 +25,7 @@ def command_list_begin(context):
|
||||
context.dispatcher.command_list = []
|
||||
|
||||
|
||||
@protocol.commands.add('command_list_end')
|
||||
@protocol.commands.add('command_list_end', list_command=False)
|
||||
def command_list_end(context):
|
||||
"""See :meth:`command_list_begin()`."""
|
||||
# TODO: batch consecutive add commands
|
||||
@ -49,7 +49,7 @@ def command_list_end(context):
|
||||
return command_list_response
|
||||
|
||||
|
||||
@protocol.commands.add('command_list_ok_begin')
|
||||
@protocol.commands.add('command_list_ok_begin', list_command=False)
|
||||
def command_list_ok_begin(context):
|
||||
"""See :meth:`command_list_begin()`."""
|
||||
context.dispatcher.command_list_receiving = True
|
||||
|
||||
@ -15,7 +15,7 @@ def close(context):
|
||||
context.session.close()
|
||||
|
||||
|
||||
@protocol.commands.add('kill')
|
||||
@protocol.commands.add('kill', list_command=False)
|
||||
def kill(context):
|
||||
"""
|
||||
*musicpd.org, connection section:*
|
||||
|
||||
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from mopidy.mpd import exceptions, protocol
|
||||
|
||||
|
||||
@protocol.handle_request(r'config$', auth_required=False)
|
||||
@protocol.commands.add('config', list_command=False)
|
||||
def config(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -17,7 +17,7 @@ def config(context):
|
||||
raise exceptions.MpdPermissionError(command='config')
|
||||
|
||||
|
||||
@protocol.handle_request(r'commands$', auth_required=False)
|
||||
@protocol.commands.add('commands', auth_required=False)
|
||||
def commands(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -40,19 +40,11 @@ def commands(context):
|
||||
command_names.update(c.name for c in protocol.mpd_commands
|
||||
if not c.auth_required)
|
||||
|
||||
# TODO: remove once we've marked all of these as list_command=False
|
||||
# No one is permited to use 'config' or 'kill', rest of commands are not
|
||||
# listed by MPD, so we shouldn't either.
|
||||
command_names = command_names - set([
|
||||
'config', 'kill', 'command_list_begin', 'command_list_ok_begin',
|
||||
'command_list_ok_begin', 'command_list_end', 'idle', 'noidle',
|
||||
'sticker'])
|
||||
|
||||
return [
|
||||
('command', command_name) for command_name in sorted(command_names)]
|
||||
|
||||
|
||||
@protocol.handle_request(r'decoders$')
|
||||
@protocol.commands.add('decoders')
|
||||
def decoders(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -79,7 +71,7 @@ def decoders(context):
|
||||
return # TODO
|
||||
|
||||
|
||||
@protocol.handle_request(r'notcommands$', auth_required=False)
|
||||
@protocol.commands.add('notcommands', auth_required=False)
|
||||
def notcommands(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -104,7 +96,7 @@ def notcommands(context):
|
||||
('command', command_name) for command_name in sorted(command_names)]
|
||||
|
||||
|
||||
@protocol.handle_request(r'tagtypes$')
|
||||
@protocol.commands.add('tagtypes')
|
||||
def tagtypes(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -116,7 +108,7 @@ def tagtypes(context):
|
||||
pass # TODO
|
||||
|
||||
|
||||
@protocol.handle_request(r'urlhandlers$')
|
||||
@protocol.commands.add('urlhandlers')
|
||||
def urlhandlers(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
|
||||
@ -40,7 +40,7 @@ def currentsong(context):
|
||||
return translator.track_to_mpd_format(tl_track, position=position)
|
||||
|
||||
|
||||
@protocol.commands.add('idle')
|
||||
@protocol.commands.add('idle', list_command=False)
|
||||
def idle(context, *subsystems):
|
||||
"""
|
||||
*musicpd.org, status section:*
|
||||
@ -96,7 +96,7 @@ def idle(context, *subsystems):
|
||||
return response
|
||||
|
||||
|
||||
@protocol.commands.add('noidle')
|
||||
@protocol.commands.add('noidle', list_command=False)
|
||||
def noidle(context):
|
||||
"""See :meth:`_status_idle`."""
|
||||
if not context.subscriptions:
|
||||
|
||||
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from mopidy.mpd import exceptions, protocol
|
||||
|
||||
|
||||
@protocol.commands.add('sticker')
|
||||
@protocol.commands.add('sticker', list_command=False)
|
||||
def sticker(context, action, field, uri, name=None, value=None):
|
||||
"""
|
||||
*musicpd.org, sticker section:*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user