summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhttp5
-rw-r--r--rotord/rotor.cpp55
2 files changed, 58 insertions, 2 deletions
diff --git a/http b/http
index 176e01a..cbf89b2 100755
--- a/http
+++ b/http
@@ -6,10 +6,11 @@ parser.add_argument("method",default="GET",nargs='?')
parser.add_argument("path",default="/",nargs='?')
parser.add_argument("body",default="body",nargs='?')
args=parser.parse_args()
-connection = httplib.HTTPConnection('127.0.0.1:9000')
+connection = httplib.HTTPConnection('54.228.219.55:9000')
connection.request(args.method, args.path, args.body)
print connection.getresponse().read()
-#connection = httplib.HTTPConnection('54.228.219.55:9000')
+#connection = httplib.HTTPConnection('54.228.219.55:80')
+#connection = httplib.HTTPConnection('127.0.0.1:9000')
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;
}