import processing.video.*; Movie movie; int newFrame = 0; PFont font; String defaultFolderPath = "/Volumes/Cistern/Guests/";//System.getProperty("user.home")+"/Desktop"; int numitems; String [] oldcontents; ArrayList newfiles; int last=-100; void setup() { size(640, 480); background(0); // Load and set the video to play. Setting the video // in play mode is needed so at least one frame is read // and we can get duration, size and other information from // the video stream. movie = new Movie(this, "/Volumes/Cistern/Guests/v-2012-06-03-12-15-04.mov"); // Pausing the video at the first frame. movie.play(); movie.loop(); movie.goToBeginning(); //movie.pause(); font = loadFont("DecoTypeNaskh-24.vlw"); textFont(font, 24); oldcontents = new String[0]; //setInputFolder(defaultFolderPath); } void movieEvent(Movie movie) { movie.read(); } void draw() { background(0); image(movie, 0, 0, width, height); fill(240, 20, 30); text(getFrame() + " / " + (getLength() - 1), 10, 30); if((millis()-last) > 1000) { checkInputFolder(defaultFolderPath); last=millis(); } } // ------ folder selection dialog + init visualization ------ void checkInputFolder(String theFolderPath) { // get files on harddisk println("\n"+theFolderPath); File file = new File(theFolderPath); String[] contents = file.list(); newfiles = new ArrayList(); if (contents != null) { // Sort the file names in case insensitive order contents = sort(contents); for (int i = 0 ; i < contents.length; i++) { // skip the . and .. directory entries on Unix systems if (contents[i].equals(".") || contents[i].equals("..") || contents[i].substring(0,1).equals(".")) { continue; } if(i>=oldcontents.length) { newfiles.add(contents[i]); } else { if(contents[i]!=oldcontents[i]) { newfiles.add(contents[i]); } } } } if(newfiles.size()>0) println(newfiles); oldcontents = contents; } // FileSystemItem selectedFolder = new FileSystemItem(new File(theFolderPath)); // selectedFolder.printDepthFirst(); // println("\n"); // selectedFolder.printBreadthFirst(); //void keyPressed() { // if (key == CODED) { // if (keyCode == LEFT) { // if (0 < newFrame) newFrame--; // } else if (keyCode == RIGHT) { // if (newFrame < getLength() - 1) newFrame++; // } // } // // // setFrame(newFrame); //} // int getFrame() { return ceil(movie.time() * movie.getSourceFrameRate()) - 1; } int getLength() { return int(movie.duration() * movie.getSourceFrameRate()); } void keyReleased() { if (key == 'o' || key == 'O') { checkInputFolder(selectFolder("please select a folder")); } }