diff options
| author | Comment <tim@gray.(none)> | 2014-03-11 09:47:04 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2014-03-11 09:47:04 +0000 |
| commit | ac1e8968254cf7810e84c0d90c80c94bc9dcd827 (patch) | |
| tree | 8cd3c833c4e960290233667f66cf4f3d24d46151 /json-instagram/src/exampleApp.cpp | |
| parent | 2a6b5328dec0ef2200bdbb94b16e8531c7c071b2 (diff) | |
instagram loader
Diffstat (limited to 'json-instagram/src/exampleApp.cpp')
| -rw-r--r-- | json-instagram/src/exampleApp.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/json-instagram/src/exampleApp.cpp b/json-instagram/src/exampleApp.cpp index 0559dce..deb4f35 100644 --- a/json-instagram/src/exampleApp.cpp +++ b/json-instagram/src/exampleApp.cpp @@ -14,34 +14,30 @@ could save with the tag id as the name of file, simpler how exactly do we parse or mipmap the images do we worry about memory - I guess not +identify the images + */ +long ofToLong(const string& intString) { + long x = 0; + istringstream cur(intString); + cur >> x; + return x; +} + //------------------------------------------------------------------------------ void exampleApp::setup() { ofSetFrameRate(24); - - std::string url = "https://api.instagram.com/v1/tags/tycleeson/media/recent?client_id=c1d74d701fdf4ddd9f8d30ee9e8f944b"; - - if (!response.open(url)) { - cout << "Failed to parse JSON\n" << endl; - } - //else cout<<response.getRawString()<<endl; - - - int numImages = MIN(5,response["data"].size()); - for(int i=0; i< numImages; i++) { - std::string url = response["data"][i]["images"]["standard_resolution"]["url"].asString(); - std::string id = response["data"][i]["caption"]["id"].asString(); - cout<<"fetching "<<id<<":"<<url<<endl; - - - ofImage img; - img.loadImage(url); - images.push_back( img ); - } - - + loader.set_interval(5.00f); + cout << "starting" << endl; + loader.start(); + cout << "started" << endl; +} + +void exampleApp::update (){ + + ofSetWindowTitle(ofToString(ofGetFrameRate())); } //------------------------------------------------------------------------------ @@ -49,7 +45,8 @@ void exampleApp::draw() { ofBackground(0); - for(int i=0; i<images.size(); i++) { - images[i].draw(i*30, i*30); - } + //for(int i=0; i<images.size(); i++) { + // images[i].draw(i*30, i*30); + //} + loader.draw(); } |
