Skip to content

Commit

Permalink
send snapshots to fpt server
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed Mar 9, 2012
1 parent 620b3d9 commit 905f21d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion FaceSubstitution/src/SnapshotSaver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ void SnapshotSaver::setup(string _folder){
ofDirectory dir(_folder);
if(!dir.exists()) dir.create(true);
folder = _folder;
ftpServer = settings.getValue("server","arturocastro.net");
user = settings.getValue("user","user");
password = settings.getValue("password","password");
serverPath = settings.getValue("serverPath","serverPath");
startThread(true,false);
}

Expand All @@ -41,6 +45,8 @@ void SnapshotSaver::threadedFunction(){
rgbPixels.setChannel(0,pixels->getChannel(0));
rgbPixels.setChannel(1,pixels->getChannel(1));
rgbPixels.setChannel(2,pixels->getChannel(2));
ofSaveImage(rgbPixels,ofFilePath::join(folder,ofGetTimestampString()+".jpg"));
string snapshotPath = ofFilePath::join(folder,ofGetTimestampString()+".jpg");
ofSaveImage(rgbPixels,snapshotPath);
system(("curl -u " + user+ ":" + password + " -T " + ofToDataPath(snapshotPath) + " ftp://" + ofFilePath::join(ftpServer , serverPath) +" & ").c_str());
}
}
6 changes: 6 additions & 0 deletions FaceSubstitution/src/SnapshotSaver.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "ofThread.h"
#include "Poco/Condition.h"
#include "ofPixels.h"
#include "ofxXmlSettings.h"

class SnapshotSaver: public ofThread {
public:
Expand All @@ -28,6 +29,11 @@ class SnapshotSaver: public ofThread {
Poco::Condition saveFrame;
string folder;
ofPixels rgbPixels;
ofxXmlSettings settings;
string ftpServer;
string user;
string password;
string serverPath;
};

#endif /* SNAPSHOTSAVER_H_ */

0 comments on commit 905f21d

Please sign in to comment.