diff options
Diffstat (limited to 'testDir/src/dirscanner.cpp')
| -rw-r--r-- | testDir/src/dirscanner.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index feb29c1..fc233d5 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -3,6 +3,12 @@ void playItem::play(){ } +bool playItem::load(string filename){ + ofFile file(filename); + string ext=file.getExtension(); + ofLogNotice() << "item "<<i<<": "<<start<<" - "<<end<<" "<<dir.getPath(i); + +} void playItem::draw(){ } @@ -29,7 +35,7 @@ void dirScanner::scan(){ if (start&&end){ slots.push_back(timeSlot(dir.getPath(i),start,end)); - ofLogNotice() << "item "<<i<<": "<<start<<" - "<<end<<" "<<dir.getPath(i); + ofLogNotice() << "directory "<<i<<": "<<start<<" - "<<end<<" "<<dir.getPath(i); } } @@ -51,8 +57,21 @@ int dirScanner::getSlotForTime(){ return -1; } -void dirPlayer::load(){ - +void dirPlayer::load(std::string path){ + items.clear(); + ofDirectory dir(path); + dir.allowExt("mp4"); + dir.allowExt("mov"); + dir.allowExt("jpg"); + // dir.allowExt("png"); + dir.listDir(); + for(int i = 0; i < dir.size(); i++){ + string d=dir.getName(i); + playItem item; + if (item.load(d)){ + items.push_back(item); + } + } } void dirPlayer::draw(){ @@ -60,9 +79,10 @@ void dirPlayer::draw(){ if (slot!=currentslot){ if (slot>-1){ ofLogNotice() << "entering slot "<<slot<<": "<<scanner->slots[slot].path; + load(scanner->slots[slot].path); } else { - ofLogNotice() << "leaving slots"; + ofLogNotice() << "leaving slot"; } currentslot=slot; } |
