diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-03-07 17:02:49 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-03-07 17:02:49 +0000 |
| commit | 0cd0501e479166998655194db6a7be60323d53b0 (patch) | |
| tree | a98c23e61cc87477e95a8ab422c2eb3c43beb9e3 /rotord/rotor.cpp | |
| parent | 8e15598cec066ef0ab54a17a09cf2221fd10bbf7 (diff) | |
REST API mocked up
Diffstat (limited to 'rotord/rotor.cpp')
| -rw-r--r-- | rotord/rotor.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
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<std::string>& response.description="<status context='"+command[1]+"'>Rotor: context busy</status>\n"; } } + if (command[2]=="video") { + if (command[0]=="GET") { + //DUMMY RESPONSE + response.status=HTTPResponse::HTTP_OK; + response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Rotor: analysing video</status>\n"; + response.description+="<progress>45.2</progress>\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="<status context='"+command[1]+"'>DUMMY RESPONSE Starting video analysis: "+command[3]+"</status>\n"; + } + else { + response.status=HTTPResponse::HTTP_NOT_FOUND; + response.description="<status context='"+command[1]+"'>File "+command[3]+" not found</status>\n"; + } + } + else { + response.status=HTTPResponse::HTTP_BAD_REQUEST; + response.description="<status context='"+command[1]+"'>Rotor: session busy</status>\n"; + } + } + } + if (command[0]=="DELETE") { + //DUMMY RESPONSE + response.description="<status>DUMMY RESPONSE 1</status>\n"; + response.status=HTTPResponse::HTTP_OK; + } + + } + if (command[2]=="render") { + if (command[0]=="GET") { + //DUMMY RESPONSE + response.status=HTTPResponse::HTTP_OK; + response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Rotor: rendering video</status>\n"; + response.description+="<progress>25.2</progress>\n"; + } + if (command[0]=="PUT") { + //DUMMY RESPONSE + //SHOULD CHECK REQUIREMENTS + response.status=HTTPResponse::HTTP_OK; + response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Rotor: starting render</status>\n"; + } + if (command[0]=="DELETE") { + //DUMMY RESPONSE + //SHOULD CHECK REQUIREMENTS + response.status=HTTPResponse::HTTP_OK; + response.description="<status context='"+command[1]+"'>DUMMY RESPONSE Rotor: cancelling render</status>\n"; + } + } return response; } |
