mpd: Cleanup imports in reflection
This commit is contained in:
parent
eb85f92d96
commit
55a46c31d7
@ -1,10 +1,9 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from mopidy.mpd.exceptions import MpdPermissionError
|
||||
from mopidy.mpd.protocol import handle_request, mpd_commands
|
||||
from mopidy.mpd import exceptions, protocol
|
||||
|
||||
|
||||
@handle_request(r'config$', auth_required=False)
|
||||
@protocol.handle_request(r'config$', auth_required=False)
|
||||
def config(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -15,10 +14,10 @@ def config(context):
|
||||
command is only permitted to "local" clients (connected via UNIX domain
|
||||
socket).
|
||||
"""
|
||||
raise MpdPermissionError(command='config')
|
||||
raise exceptions.MpdPermissionError(command='config')
|
||||
|
||||
|
||||
@handle_request(r'commands$', auth_required=False)
|
||||
@protocol.handle_request(r'commands$', auth_required=False)
|
||||
def commands(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -28,11 +27,11 @@ def commands(context):
|
||||
Shows which commands the current user has access to.
|
||||
"""
|
||||
if context.dispatcher.authenticated:
|
||||
command_names = set([command.name for command in mpd_commands])
|
||||
command_names = set(command.name for command in protocol.mpd_commands)
|
||||
else:
|
||||
command_names = set([
|
||||
command.name for command in mpd_commands
|
||||
if not command.auth_required])
|
||||
command_names = set(
|
||||
command.name for command in protocol.mpd_commands
|
||||
if not command.auth_required)
|
||||
|
||||
# No one is permited to use 'config' or 'kill', rest of commands are not
|
||||
# listed by MPD, so we shouldn't either.
|
||||
@ -45,7 +44,7 @@ def commands(context):
|
||||
('command', command_name) for command_name in sorted(command_names)]
|
||||
|
||||
|
||||
@handle_request(r'decoders$')
|
||||
@protocol.handle_request(r'decoders$')
|
||||
def decoders(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -72,7 +71,7 @@ def decoders(context):
|
||||
return # TODO
|
||||
|
||||
|
||||
@handle_request(r'notcommands$', auth_required=False)
|
||||
@protocol.handle_request(r'notcommands$', auth_required=False)
|
||||
def notcommands(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -84,8 +83,8 @@ def notcommands(context):
|
||||
if context.dispatcher.authenticated:
|
||||
command_names = []
|
||||
else:
|
||||
command_names = [
|
||||
command.name for command in mpd_commands if command.auth_required]
|
||||
command_names = [command.name for command in protocol.mpd_commands
|
||||
if command.auth_required]
|
||||
|
||||
# No permission to use
|
||||
command_names.append('config')
|
||||
@ -95,7 +94,7 @@ def notcommands(context):
|
||||
('command', command_name) for command_name in sorted(command_names)]
|
||||
|
||||
|
||||
@handle_request(r'tagtypes$')
|
||||
@protocol.handle_request(r'tagtypes$')
|
||||
def tagtypes(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
@ -107,7 +106,7 @@ def tagtypes(context):
|
||||
pass # TODO
|
||||
|
||||
|
||||
@handle_request(r'urlhandlers$')
|
||||
@protocol.handle_request(r'urlhandlers$')
|
||||
def urlhandlers(context):
|
||||
"""
|
||||
*musicpd.org, reflection section:*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user