void setup() { size(800,600,P2D); loadVideo("LondonUnderground.mp4"); loadAudio("Underground.mp3"); playAudioFrom(00000); } void script() { String next = getNext(); if(next.contains("Severe Delays")) { playVideoFrom(0001); } else if(next.contains("Minor Delays")) { playVideoFrom(2560); } else if(next.contains("Good Service")) { float r = random(3); if(r > 2) { playVideoFrom(12800); } else if(r > 1) { playVideoFrom(15360); } else { playVideoFrom(17920); } } else if(next.contains("Part Closure")) { playVideoFrom(7680); } else if(next.contains("Part Suspended")) { playVideoFrom(10240); } else if(next.contains("Planned Closure")) { playVideoFrom(5120); } //TINT BW MOVIE with colour of tube line affected if(next.contains("Central")) { tint(229,31,32,50); } else if(next.contains("Bakerloo")) { tint(174,97,25,50); } else if(next.contains("Circle")) { tint(247,210,34,50); } else if(next.contains("District")) { tint(0,166,117,50); } else if(next.contains("DLR")) { tint(0,187,180,50); } else if(next.contains("H'smith & City")) { tint(232,153,168,50); } else if(next.contains("Jubilee")) { tint(104,110,114,50); } else if(next.contains("Metropolitan")) { tint(137,50,103,50); } else if(next.contains("Northern")) { tint(0,0,0,30); } else if(next.contains("Overground")) { tint(248,108,0,50); } else if(next.contains("Piccadilly")) { tint(4,80,161,50); } else if(next.contains("Victoria")) { tint(0,159,224,50); } else if(next.contains("Waterloo & City")) { tint(112,195,206,50); } setBrightness(slider1.getValue()); setOpacity(slider2.getValue()); setScaling(slider3.getValue()); setVolume(slider4.getValue()); delay(2560); }
String[] headlines;
int pointer = 0;
void loadData()
{
print("Getting data from database...");
XMLElement xml = new XMLElement(this, "http://tubeupdates.com/rss/all.xml");
println("DONE");
int readingCount = xml.getChild(0).getChildCount();
headlines = new String[readingCount];
for (int i=0; i<readingCount ;i++) {
if (xml.getChild(0).getChild(i).getChild("title") != null) {
headlines[i] = xml.getChild(0).getChild(i).getChild("title").getContent();
}
else {
headlines[i] = "";
}
}
}
String getNext()
{
if(headlines == null) loadData();
pointer++;
if(pointer>headlines.length-1) pointer = 0;
return headlines[pointer];
}