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){ void ImageViewer::setImage(std::string imagePath){
if(displayImage.isAllocated()) if(displayImage.isAllocated())
displayImage.clear(); displayImage.clear();
displayImage.load("images/rte-archive-football/" + imagePath); displayImage.load(imagePath);
} }
void ImageViewer::calcImageScalePos(){ void ImageViewer::calcImageScalePos(){

17
src/Player.cpp

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

6
src/Request.cpp

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

6
src/Request.h

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

Loading…
Cancel
Save