예제 #1
0
 def send(self, req):
     app = self._app
     success, msg = exec_cmd(req.to_cmd(),
                             library=app.library,
                             player=app.player,
                             playlist=app.playlist,
                             live_lyric=app.live_lyric)
     code = 'OK' if success else 'Oops'
     return Response(code=code, content=msg)
예제 #2
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)
예제 #3
0
파일: server.py 프로젝트: zzcandor/FeelUOwn
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)