diff options
| author | Comment <tim@gray.(none)> | 2013-09-09 22:21:24 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-09-09 22:21:24 +0100 |
| commit | 5606479f9ef49f11a39c52cbad925edbb8709c76 (patch) | |
| tree | 4ca8e6ab946c4e448cffd94435da794429a639da /rotord/src/rendercontext.cpp | |
| parent | 131b0c7a1951abaf0fe6e58250c9d74306bc5518 (diff) | |
change load order
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 8b4053f..aacc692 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"); |
