From 06c11d8aa29e3a097c3ceb076b7d78f1c28a974f Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 27 Feb 2013 12:00:18 +0000 Subject: parsing work packet --- httptest.py | 11 ----------- rotord/rotor.h | 16 ++++++++++++++++ rotord/rotord.cpp | 29 ++++++++++++++++++----------- 3 files changed, 34 insertions(+), 22 deletions(-) delete mode 100755 httptest.py diff --git a/httptest.py b/httptest.py deleted file mode 100755 index a368fe4..0000000 --- a/httptest.py +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/python -import httplib -import argparse -parser = argparse.ArgumentParser() -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.request(args.method, args.path, args.body) -print connection.getresponse().read() diff --git a/rotord/rotor.h b/rotord/rotor.h index 4961b98..594465d 100755 --- a/rotord/rotor.h +++ b/rotord/rotor.h @@ -134,6 +134,22 @@ namespace Rotor { mutex.lock(); work_queue.push_back(item); mutex.unlock(); + } + std::string session_command(const std::vector& command){ + string response; + mutex.lock(); + if (command[1]=="audio") { + if (command[0]=="PUT") { + //get audio file location and initiate analysis + if (command.size()>1) { + //pass message to task + work_queue.push_back(command[2]); + response="1\n"; + } + } + } + mutex.unlock(); + return response; } Render_status get_status(); void cancel(); //interrupt locking process diff --git a/rotord/rotord.cpp b/rotord/rotord.cpp index 22e2e9f..c4103e3 100755 --- a/rotord/rotord.cpp +++ b/rotord/rotord.cpp @@ -197,19 +197,26 @@ HTTPRequestHandler* RotorRequestHandlerFactory::createRequestHandler(const HTTPS //could have a seperate mutex for the graph //all the get methods want to get something from the render context and express it in xml. //what is the best way... - if (command[1]=="audio") { - if (request.getMethod()=="PUT") { - //get audio file location and initiate analysis - std::string s; - std::ostringstream os; - os<)task)->add_queue(s); - content="1\n"; - } + //should the processing be done inside the render context - I think so + + //++++ processing inside object + //---- processing occurring in different places + + //the idea of command queueing won't work + + std::string s; + std::ostringstream os; + os< sc; + sc.push_back(request.getMethod()); + for (auto& i: command){ + sc.push_back(i); } + sc.push_back(s); + content=((Poco::AutoPtr)task)->session_command(command); } } } -- cgit v1.2.3