summaryrefslogtreecommitdiff
path: root/NT/src
diff options
context:
space:
mode:
Diffstat (limited to 'NT/src')
-rw-r--r--NT/src/rendercontext.cpp18
-rw-r--r--NT/src/rendercontext.h7
2 files changed, 13 insertions, 12 deletions
diff --git a/NT/src/rendercontext.cpp b/NT/src/rendercontext.cpp
index 631f4b8..28e722d 100644
--- a/NT/src/rendercontext.cpp
+++ b/NT/src/rendercontext.cpp
@@ -35,15 +35,15 @@ void Render_context::runTask() {
renders[cmd.uid].status=FAILED;
}
}
- if(cmd.task==LOAD_GRAPH) {
+ if(cmd.task==LOAD_GRAPH_FILE||cmd.task==LOAD_GRAPH_STRING) {
state=LOADING_GRAPH;
- if (graph_filename!="") {
- if (!graph.loadFile(cmd.message,media_path)){
- cerr<<"Rotor: failed to load graph from "<<graph_filename<<endl;
+ if(cmd.task==LOAD_GRAPH_FILE) {
+ if (!graph.load_file(cmd.message,media_path)){
+ cerr<<"Rotor: failed to load graph from "<<cmd.message<<endl;
}
}
- else if (graph_body!="") {
- if (!graph.load(graph_body,media_dir)) {
+ if(cmd.task==LOAD_GRAPH_STRING) {
+ if (!graph.parse_json(cmd.message,media_path)) {
cerr<<"Rotor: failed to load graph from body request"<<endl;
}
}
@@ -126,7 +126,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.method=="PUT") { //get audio file location and initiate analysis
if (command.body!="") {
if (state==IDLE) {
- graph.audio_filename=media_dir+command.body; //for now, store session variables in memory //check file exists
+ graph.audio_filename=media_path+command.body; //for now, store session variables in memory //check file exists
Poco::File f=Poco::File(graph.audio_filename);
if (f.exists()) {
add_queue(Session_task(command.uid,ANALYSE_AUDIO));
@@ -211,7 +211,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
//before begining to load from xml
if (state==IDLE) { //eventually not like this
if (command.body!="") {
- string graph_filename=graph_dir+command.body;
+ string graph_filename=graph_path+command.body;
string graph_body="";
if (Poco::File(graph_filename).exists()) {;
add_queue(Session_task(command.uid,LOAD_GRAPH,graph_filename));
@@ -295,7 +295,7 @@ void Render_context::session_command(const Session_command& command,xmlIO& XML,H
if (command.body!="") { //there should be a filename + a destination node
if (state!=RENDERING) {
if (command.commands.size()>2) {
- string video_filename=media_dir+command.body;
+ string video_filename=media_path+command.body;
//check file exists
Poco::File f=Poco::File(video_filename);
if (f.exists()) {
diff --git a/NT/src/rendercontext.h b/NT/src/rendercontext.h
index 3ac9c08..72c589e 100644
--- a/NT/src/rendercontext.h
+++ b/NT/src/rendercontext.h
@@ -72,9 +72,9 @@ namespace Rotor {
};
class Render_context: public Poco::Task {
public:
- Render_context(const std::string& _id,const std::string& _media_dir=""): Task(_id) {
+ Render_context(const std::string& _id,const std::string& _media_path=""): Task(_id) {
id=_id;
- media_dir=_media_dir;
+ media_path=_media_path;
graph.init(id);
//set up log
AutoPtr<SplitterChannel> splitterChannel(new SplitterChannel());
@@ -122,7 +122,8 @@ namespace Rotor {
std::unordered_map<std::string,Render_status> renders;
std::unordered_map<std::string,Render_settings> profiles;
std::string profile;
- std::string media_dir;
+ std::string media_path;
+ std::string graph_path;
std::deque<Session_task> work_queue;
Poco::Mutex mutex;