Browse Source

updated to match new json

master
cailean 4 months ago
parent
commit
19d9099e77
  1. 2
      src/ImageViewer.cpp
  2. 17
      src/Player.cpp
  3. 6
      src/Request.cpp
  4. 6
      src/Request.h

2
src/ImageViewer.cpp

@ -24,7 +24,7 @@ void ImageViewer::draw(){
void ImageViewer::setImage(std::string imagePath){
if(displayImage.isAllocated())
displayImage.clear();
displayImage.load("images/rte-archive-football/" + imagePath);
displayImage.load(imagePath);
}
void ImageViewer::calcImageScalePos(){

17
src/Player.cpp

@ -5,9 +5,10 @@ Player::Player(){
playerVideoIndex = 0;
req.setup("192.168.0.54", 2000, "search");
resp.filename = "fingers.mp4";
resp.frame = 50;
resp.index = 0;
resp.folder = "fingers.mp4";
resp.video = "movies/fingers.mp4";
resp.image = "images/happy.png";
resp.frame = 0;
}
void Player::setup(){
@ -48,14 +49,13 @@ void Player::draw(){
}
void Player::setVideo(VPQuery query){
videoPath = query.filename;
videoPlayer.load("movies/" + videoPath);
videoPath = query.video;
videoPlayer.load(videoPath);
videoPlayer.setFrame(query.frame);
setVideoPosition();
currentVideoLabel = query.filename;
currentIndexLabel = ofToString(query.index);
currentVideoLabel = query.folder;
videoPlayer.play();
}
@ -89,7 +89,7 @@ void Player::setRandomFrame(){
string Player::getFrameName(){
string imagePath = resp.imagePath;
string imagePath = resp.image;
return imagePath;
}
@ -109,7 +109,6 @@ void Player::setupGUI(){
gui.add(currentFrameLabel.setup("Current Frame", ofToString(playerCurrentFrame)));
gui.add(currentVideoLabel.setup("Video Name", videoPath));
gui.add(currentIndexLabel.setup("Index", ofToString(playerVideoIndex)));
currentVector.angry = angrySlider;
currentVector.disgust = disgustSlider;

6
src/Request.cpp

@ -24,10 +24,10 @@ VPQuery Request::query(Vector7D input){
jsonResponse = ofJson::parse(response.data.getText());
VPQuery queryResponse;
queryResponse.filename = jsonResponse["filename"];
queryResponse.imagePath = jsonResponse["imagePath"];
queryResponse.folder = jsonResponse["folder"];
queryResponse.image = jsonResponse["image"];
queryResponse.video = jsonResponse["video"];
queryResponse.frame = ofToInt(jsonResponse["frame"]) + 10;
queryResponse.index = jsonResponse["index"];
return queryResponse;
}

6
src/Request.h

@ -28,10 +28,10 @@ struct Vector7D{
// JSON -> Struct
struct VPQuery{
std::string filename;
std::string imagePath;
std::string folder;
std::string video;
std::string image;
int frame;
int index;
};
class Request {

Loading…
Cancel
Save