#include "dirscanner.h" void playItem::play(){ //ofLogNotice() << "playing----->"<0; } void playItem::draw(){ if (image.isAllocated()){ //ofEnableAlphaBlending(); //ofSetColor(255,255,255,1.0); image.draw(0,0,1080*FACTOR,1920*FACTOR); //ofDisableAlphaBlending(); if (ofGetElapsedTimef()-startTime>5.0){ isFinished=true; } } //if (video.isLoaded()){ //video.update(); if (video.getIsOpen()){ video.draw(0,0,1080*FACTOR,1920*FACTOR); //if (video.getIsMovieDone()){ if (!video.isPlaying()){ isFinished=true; } } } 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)); } } } int dirScanner::getSlotForTime(){ /* read vector of slots return index of current time naive approach? assuming that the list is valid */ int railwaytime=(ofGetHours()*100)+ofGetMinutes(); for(int i = 0; i < slots.size(); i++){ if (slots[i].start=railwaytime){ return i; } } else { if (slots[i].end>=railwaytime||slots[i].start<=railwaytime){ return i; } } } return -1; } void dirPlayer::load(std::string path){ ofLogNotice() << "loading path: "<getSlotForTime(); if(slot==-1) return false; if (slot!=currentslot){ ofLog(OF_LOG_NOTICE) << "loading slot: "<-1){ load(scanner->slots[slot].path); } currentslot=slot; } if (items[currentItem].isFinished){ items[currentItem].isFinished=false; currentItem=(currentItem+1)%items.size(); items[currentItem].play(); } items[currentItem].draw(); return true; }