diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-09-10 09:48:00 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-09-10 09:48:00 +0100 |
| commit | 1ba984e17672dd214e4e239c6806ee2e739432e8 (patch) | |
| tree | 80596bd998b2fbab5810226bad0a9e31096eb047 /rotord/src/rendercontext.cpp | |
| parent | df0d3f135685c77b401be24596fb381f822e7f96 (diff) | |
| parent | 695d389eb125cbbd469a8de53616579b18a1bfba (diff) | |
Merge branch 'master' of eclectronics.org@eclectronics.org:rotor
Diffstat (limited to 'rotord/src/rendercontext.cpp')
| -rw-r--r-- | rotord/src/rendercontext.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/rotord/src/rendercontext.cpp b/rotord/src/rendercontext.cpp index c1cef59..62c60c0 100644 --- a/rotord/src/rendercontext.cpp +++ b/rotord/src/rendercontext.cpp @@ -175,21 +175,8 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H //should interrupt whatever is happening? //before begining to load from xml if (state==IDLE) { //eventually not like this - if (graph.load(command.body,media_dir)) { - status=HTTPResponse::HTTP_OK; - logger.information("Loaded graph from http PUT body"); - XML.addValue("status","Loaded graph from PUT body"); - if (graph.audio_loaded) { - add_queue(Session_task(command.uid,ANALYSE_AUDIO)); - status=HTTPResponse::HTTP_OK; - logger.information("Starting audio analysis for graph: "+command.commands[0]); - XML.addValue("status","Starting audio analysis for graph: "+command.commands[0]); - } - } - else { - string graph_filename=graph_dir+command.body; - Poco::File f=Poco::File(graph_filename); - if (f.exists()) { + if (Poco::File(graph_dir+command.body).exists()) { + string graph_filename=graph_dir+command.body; if (graph.loadFile(graph_filename,media_dir)) { status=HTTPResponse::HTTP_OK; //XML.addValue("patchbay",graph.toString()); @@ -208,16 +195,26 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H } else { status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; //~/sources/poco-1.4.6-all/Net/include/Poco/Net/HTTPResponse.h - logger.error("ERROR: graph not loaded: check XML"); - XML.addValue("error","graph not loaded: check XML"); + logger.error("ERROR: graph not loaded: check file"); + XML.addValue("error","graph not loaded: check file"); } } - else { - status=HTTPResponse::HTTP_NOT_FOUND; - logger.error("ERROR: "+command.body+" not found"); - XML.addValue("error",command.body+" not found"); + else if (graph.load(command.body,media_dir)) { + status=HTTPResponse::HTTP_OK; + logger.information("Loaded graph from http PUT body"); + XML.addValue("status","Loaded graph from PUT body"); + if (graph.audio_loaded) { + add_queue(Session_task(command.uid,ANALYSE_AUDIO)); + status=HTTPResponse::HTTP_OK; + logger.information("Starting audio analysis for graph: "+command.commands[0]); + XML.addValue("status","Starting audio analysis for graph: "+command.commands[0]); } } + else { + status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; //~/sources/poco-1.4.6-all/Net/include/Poco/Net/HTTPResponse.h + logger.error("ERROR: graph unreadable"); + XML.addValue("error","graph unreadable"); + } } else { logger.error("ERROR: Session busy"); |
