We Feel…Fine?

Screen Shot 2014-05-04 at 10.03.51 PM

How are you feeling?

Fine is a four-lettered placeholder.

This grabs feelings from the We Feel Fine API. We Feel Fine’s system searches blog entries for occurrences of the phrases “I feel” and “I am feeling.” The latest feeling (sentence) displays in the console and in the sketch – it refreshes every 20 seconds. Usually, it takes up to 40 seconds for a new feeling to surface.

Things to fix:

– Somehow ignore the <feelings></feelings> part of the String, so that only the sentence shows up

– Fit the whole sentence inside of a text box (attempted, but did not work).

Things to add:

– Color change every time the feeling ascribed to the sentence changes. Something that correlates with Goethe’s ideas about psychology in relation to¬†color & emotion.

//most of the code is from the class example with the NYT headlines
String title = "Gathering feelings...";
int lastTimeChecked;
int xpos;

void setup() {
  size(800, 200);
  // textAlign(CENTER,CENTER);
}

void draw() {
  background(0);

  if (millis() - lastTimeChecked > 20000) { 
  //use a timer to check every 20 seconds, because it doesn't update that often anyways
    thread("loadFeelings");  //start a parallel thread to ask for feelings
    lastTimeChecked = millis();   
  }

   /*
   //Attempting to fit all the text within a text box...
   text(title, 200,200, xpos, height/2); //this animation stays smooth because you used a thread
   */

   text(title, xpos, height/2);
   xpos++
    if (xpos > width) xpos = 0;
  }

void loadFeelings() {
  XML root = loadXML("http://api.wefeelfine.org:8080/ShowFeelings?display=xml&returnfields=sentence&limit=1");
  title = root.toString();

  println("check" + title);
}

 

 

Leave a Reply