From 0cd0501e479166998655194db6a7be60323d53b0 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 7 Mar 2013 17:02:49 +0000 Subject: REST API mocked up --- rotord/rotor.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'rotord/rotor.cpp') diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 1094428..c894e04 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -198,6 +198,61 @@ Command_response Render_context::session_command(const std::vector& response.description="Rotor: context busy\n"; } } + if (command[2]=="video") { + if (command[0]=="GET") { + //DUMMY RESPONSE + response.status=HTTPResponse::HTTP_OK; + response.description="DUMMY RESPONSE Rotor: analysing video\n"; + response.description+="45.2\n"; + } + if (command[0]=="PUT") { //get vide file location and initiate analysis + if (command.size()>2) { + if (state==IDLE) { + //check file exists + Poco::File f=Poco::File(command[3]); + if (f.exists()) { + //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read?? + //DUMMY RESPONSE + response.description="DUMMY RESPONSE Starting video analysis: "+command[3]+"\n"; + } + else { + response.status=HTTPResponse::HTTP_NOT_FOUND; + response.description="File "+command[3]+" not found\n"; + } + } + else { + response.status=HTTPResponse::HTTP_BAD_REQUEST; + response.description="Rotor: session busy\n"; + } + } + } + if (command[0]=="DELETE") { + //DUMMY RESPONSE + response.description="DUMMY RESPONSE 1\n"; + response.status=HTTPResponse::HTTP_OK; + } + + } + if (command[2]=="render") { + if (command[0]=="GET") { + //DUMMY RESPONSE + response.status=HTTPResponse::HTTP_OK; + response.description="DUMMY RESPONSE Rotor: rendering video\n"; + response.description+="25.2\n"; + } + if (command[0]=="PUT") { + //DUMMY RESPONSE + //SHOULD CHECK REQUIREMENTS + response.status=HTTPResponse::HTTP_OK; + response.description="DUMMY RESPONSE Rotor: starting render\n"; + } + if (command[0]=="DELETE") { + //DUMMY RESPONSE + //SHOULD CHECK REQUIREMENTS + response.status=HTTPResponse::HTTP_OK; + response.description="DUMMY RESPONSE Rotor: cancelling render\n"; + } + } return response; } -- cgit v1.2.3