Пример #1
0
 def handle_req(self, req, session=None):
     cmd = Cmd(req.cmd, *req.cmd_args, options=req.cmd_options)
     success, msg = exec_cmd(cmd,
                             library=self._app.library,
                             player=self._app.player,
                             playlist=self._app.playlist,
                             live_lyric=self._app.live_lyric)
     code = 'ok' if success else 'oops'
     return Response(code=code, msg=msg, req=req)
Пример #2
0
def handle_request(req, app, ctx=None):
    """
    :type req: fuocore.protocol.Request
    """
    if not _REGISTERED:
        register_feeluown_serializers()

    cmd = Cmd(req.cmd, *req.cmd_args, options=req.cmd_options)
    ok, body = exec_cmd(cmd, app=app)
    format = req.options.get('format', 'plain')
    msg = serialize(format, body, brief=False)
    return Response(ok=ok, text=msg, req=req)
Пример #3
0
 def to_cmd(self):
     if self.options_str:
         options = Parser(self.options_str).parse_cmd_options()
     else:
         options = {}
     return Cmd(self.cmd, *self.args, options=options)
Пример #4
0
 def to_cmd(self):
     return Cmd(self.cmd, *self.args)