summaryrefslogtreecommitdiff
path: root/testDir
diff options
context:
space:
mode:
Diffstat (limited to 'testDir')
-rw-r--r--testDir/src/dirscanner.cpp28
-rw-r--r--testDir/src/dirscanner.h8
2 files changed, 31 insertions, 5 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;
}
diff --git a/testDir/src/dirscanner.h b/testDir/src/dirscanner.h
index f78c6d5..dfc0847 100644
--- a/testDir/src/dirscanner.h
+++ b/testDir/src/dirscanner.h
@@ -16,12 +16,18 @@ class timeSlot {
class playItem {
public:
+ playItem(){
+ loaded=0;
+ }
playItem(std::string _n){
filename=_n;
+ playItem();
}
string filename;
ofImage image;
ofVideoPlayer video;
+ int loaded; //0- none, 1- image, 2- mov
+ bool load(string filename);
void play();
void draw();
bool isFinished();
@@ -53,6 +59,6 @@ class dirPlayer {
string playdir;
int currentslot;
dirScanner *scanner;
- void load();
+ void load(std::string path);
void draw();
}; \ No newline at end of file