Пример #1
0
def kill(context):
    """
    *musicpd.org, connection section:*

        ``kill``

        Kills MPD.
    """
    raise exceptions.MpdPermissionError(command="kill")
Пример #2
0
def config(context):
    """
    *musicpd.org, reflection section:*

        ``config``

        Dumps configuration values that may be interesting for the client. This
        command is only permitted to "local" clients (connected via UNIX domain
        socket).
    """
    raise exceptions.MpdPermissionError(command="config")
Пример #3
0
 def _authenticate_filter(self, request, response, filter_chain):
     if self.authenticated:
         return self._call_next_filter(request, response, filter_chain)
     elif self.config["mpd"]["password"] is None:
         self.authenticated = True
         return self._call_next_filter(request, response, filter_chain)
     else:
         command_name = request.split(" ")[0]
         command = protocol.commands.handlers.get(command_name)
         if command and not command.auth_required:
             return self._call_next_filter(request, response, filter_chain)
         else:
             raise exceptions.MpdPermissionError(command=command_name)