diff options
| author | Comment <tim@gray.(none)> | 2013-03-03 20:21:46 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-03-03 20:21:46 +0000 |
| commit | 87b2dabd9dd692aa505ea1327893d719f56fa162 (patch) | |
| tree | a731429afc7fa2ac4267ef48a07febdea8fa2299 /rotord/rotor.cpp | |
| parent | 67a7395433c49c2e3ae193ca983e3349f68268eb (diff) | |
xml transfusion
Diffstat (limited to 'rotord/rotor.cpp')
| -rw-r--r-- | rotord/rotor.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 8af1f0b..8360824 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -48,22 +48,22 @@ Command_response Render_context::session_command(const std::vector<std::string>& //pass to worker thread ??if engine is ready?? ??what if engine has finished but results aren't read?? audio_filename=command[3]; //for now, store session variables in memory add_queue(ANALYSE_AUDIO); - response.description="<status>Starting audio analysis: "+command[3]+"</status>\n"; + response.description="<status context='"+command[1]+"'>Starting audio analysis: "+command[3]+"</status>\n"; } else { response.status=HTTPResponse::HTTP_NOT_FOUND; - response.description="<status>File "+command[3]+" not found</status>\n"; + response.description="<status context='"+command[1]+"'>File "+command[3]+" not found</status>\n"; } } else { response.status=HTTPResponse::HTTP_BAD_REQUEST; - response.description="<status>Rotor: session busy</status>\n"; + response.description="<status context='"+command[1]+"'>Rotor: session busy</status>\n"; } } } if (command[0]=="GET") { if (state==ANALYSING_AUDIO) { - response.description="<status>Rotor: analysing audio</status>\n"; + response.description="<status context='"+command[1]+"'>Rotor: analysing audio</status>\n"; char c[20]; sprintf(c,"%02f",audio_analyser.get_progress()); response.description+="<progress>"+string(c)+"</progress>\n"; @@ -72,7 +72,7 @@ Command_response Render_context::session_command(const std::vector<std::string>& //not sure about this-- should this state be retained? //can the data only be read once? //for now - response.description="<status>Rotor: audio ready</status>\n"; + response.description="<status context='"+command[1]+"'>Rotor: audio ready</status>\n"; response.description+="<beats>"; for (auto& i: audio_analyser.beats) { //is actually giving no data? char c[20]; @@ -88,9 +88,30 @@ Command_response Render_context::session_command(const std::vector<std::string>& if (command[0]=="PUT") { //get new graph from file if (command.size()>2) { //should interrupt whatever is happening? - //before beggining to load from xml + //before begining to load from xml + if (state==IDLE) { //eventually not like this + Poco::File f=Poco::File(command[3]); + if (f.exists()) { + string graph_filename=command[3]; + if (load_graph(graph_filename)) { + response.description="<status context='"+command[1]+"'>Rotor: loaded graph "+command[3]+"</status>\n"; + } + else { + response.status=HTTPResponse::HTTP_INTERNAL_SERVER_ERROR; //~/sources/poco-1.4.6-all/Net/include/Poco/Net/HTTPResponse.h + response.description="<status context='"+command[1]+"'>Rotor: could not load graph "+command[3]+"</status>\n"; + } + } + else { + response.status=HTTPResponse::HTTP_NOT_FOUND; + response.description="<status context='"+command[1]+"'>File "+command[3]+" not found</status>\n"; + } + } } } } return response; +} + +bool Render_context::load_graph(string graph_filename){ + return true; }
\ No newline at end of file |
