#include "dirscanner.h" void playItem::play(){ } bool playItem::load(string filename){ ofFile file(filename); string ext=ofToLower(file.getExtension()); loaded=0; if (ext=="jpg"||ext=="png"){ if (image.load(filename)){ ofLogNotice() << "loaded image: "<0; } void playItem::draw(){ } bool playItem::isFinished(){ } void dirScanner::scan(){ /* parse directories and create structure showing which folder to check at which time */ slots.clear(); ofDirectory dir(rootdir); dir.allowExt(""); //get directories dir.listDir(); for(int i = 0; i < dir.size(); i++){ string d=dir.getName(i); int start = ofToInt(d.substr(0,4)); int end = ofToInt(d.substr(5,4)); if (start&&end){ slots.push_back(timeSlot(dir.getPath(i),start,end)); ofLogNotice() << "directory "<=railwaytime){ return i; } } return -1; } void dirPlayer::load(std::string path){ items.clear(); ofDirectory dir(path); dir.allowExt("mkv"); dir.allowExt("mov"); dir.allowExt("jpg"); // dir.allowExt("png"); dir.listDir(); for(int i = 0; i < dir.size(); i++){ string d=dir.getPath(i); playItem item; if (item.load(d)){ items.push_back(item); } } } void dirPlayer::draw(){ int slot=scanner->getSlotForTime(); if (slot!=currentslot){ if (slot>-1){ ofLogNotice() << "entering slot "<slots[slot].path; load(scanner->slots[slot].path); } else { ofLogNotice() << "leaving slot"; } currentslot=slot; } }