summaryrefslogtreecommitdiff
path: root/rotord/src/rendercontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rendercontext.cpp')
-rw-r--r--rotord/src/rendercontext.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp
index 47ff9c1..77adc71 100644
--- a/rotord/src/rendercontext.cpp
+++ b/rotord/src/rendercontext.cpp
@@ -295,6 +295,47 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
XML.addValue("error","Bad request");
}
}
+ else {
+ status=HTTPResponse::HTTP_BAD_REQUEST;
+ logger.error("ERROR: Bad request");
+ XML.addValue("error","Bad request");
+ }
+ }
+ if (command.commands[1]=="preview") {
+ if (command.method=="GET") {
+ if(state==IDLE){
+ //parse json to get preview spec, return XML? this is a mess
+ string preview_node=command.commands[2];
+ Json::Value root; // will contains the root value after parsing.
+ Json::Reader reader;
+ if (reader.parse( command.body, root )) {
+ int frame=root["frame"].asInt();
+ int width=root["width"].asInt();
+ int height=root["height"].asInt();
+ string resolution=root["resolution"].asString();
+ cerr<<"preview: "<<frame<<" "<<width<<" "<<height<<" "<<resolution<<endl;
+ //if (graph.preview(XML,frame,resolution))
+ status=HTTPResponse::HTTP_OK;
+ }
+ else {
+ std::cout << "Failed to parse preview request\n"
+ << reader.getFormattedErrorMessages();
+ status=HTTPResponse::HTTP_BAD_REQUEST;
+ logger.error("ERROR: Bad preview request");
+ XML.addValue("error","Bad preview request");
+ }
+ }
+ else {
+ status=HTTPResponse::HTTP_BAD_REQUEST;
+ logger.error("ERROR: Session busy");
+ XML.addValue("error","Session busy");
+ }
+ }
+ else {
+ status=HTTPResponse::HTTP_BAD_REQUEST;
+ logger.error("ERROR: Bad request");
+ XML.addValue("error","Bad request");
+ }
}
if (command.commands[1]=="render") {
if (command.method=="GET") {