From 6ae491eea38055ebe3ba1154f0e916d7bbf95040 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 22 May 2017 21:31:33 +0100 Subject: directory reader in test case --- testDir/src/dirscanner.cpp | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 testDir/src/dirscanner.cpp (limited to 'testDir/src/dirscanner.cpp') diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp new file mode 100644 index 0000000..feb29c1 --- /dev/null +++ b/testDir/src/dirscanner.cpp @@ -0,0 +1,71 @@ +#include "dirscanner.h" + +void playItem::play(){ + +} +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() << "item "<=railwaytime){ + return i; + } + } + return -1; +} + +void dirPlayer::load(){ + +} + +void dirPlayer::draw(){ + int slot=scanner->getSlotForTime(); + if (slot!=currentslot){ + if (slot>-1){ + ofLogNotice() << "entering slot "<slots[slot].path; + } + else { + ofLogNotice() << "leaving slots"; + } + currentslot=slot; + } + + +} \ No newline at end of file -- cgit v1.2.3 From e49c8555552c76b526a798f16ec5327fe443141a Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 25 May 2017 00:21:51 +0100 Subject: load logic --- testDir/src/dirscanner.cpp | 28 ++++++++++++++++++++++++---- testDir/src/dirscanner.h | 8 +++++++- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'testDir/src/dirscanner.cpp') 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 @@ -2,6 +2,12 @@ void playItem::play(){ +} +bool playItem::load(string filename){ + ofFile file(filename); + string ext=file.getExtension(); + ofLogNotice() << "item "<-1){ ofLogNotice() << "entering slot "<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 -- cgit v1.2.3 From 7a201017da4b0aedd79bb93747c855fe63b5ede9 Mon Sep 17 00:00:00 2001 From: tim Date: Sun, 28 May 2017 22:12:27 +0100 Subject: video playback issue --- testDir/src/dirscanner.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'testDir/src/dirscanner.cpp') diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index fc233d5..34dec9b 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -5,9 +5,21 @@ void playItem::play(){ } bool playItem::load(string filename){ ofFile file(filename); - string ext=file.getExtension(); - ofLogNotice() << "item "<0; } void playItem::draw(){ @@ -60,13 +72,13 @@ int dirScanner::getSlotForTime(){ void dirPlayer::load(std::string path){ items.clear(); ofDirectory dir(path); - dir.allowExt("mp4"); + 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.getName(i); + string d=dir.getPath(i); playItem item; if (item.load(d)){ items.push_back(item); -- cgit v1.2.3 From a0e8fefd1bf241b805c4542421bdbc6a4447fdc3 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 30 May 2017 00:50:56 +0100 Subject: no alpha or movs --- testDir/src/dirscanner.cpp | 47 +++++++++++++++++++++++++++++++++++++--------- testDir/src/dirscanner.h | 4 +++- testDir/src/main.cpp | 4 ++-- testDir/src/ofApp.cpp | 3 +-- 4 files changed, 44 insertions(+), 14 deletions(-) (limited to 'testDir/src/dirscanner.cpp') diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index 34dec9b..f3aa974 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -1,9 +1,17 @@ #include "dirscanner.h" void playItem::play(){ - + if (video.isLoaded()){ + video.play(); + ofLogNotice() << "playing video: "<0; } void playItem::draw(){ + if (image.isAllocated()){ -} -bool playItem::isFinished(){ + //ofEnableAlphaBlending(); + //ofSetColor(255,255,255,1.0); + image.draw(0,0); + //ofDisableAlphaBlending(); + if (ofGetElapsedTimef()-startTime>5.0){ + isFinished=true; + } + } + if (video.isLoaded()){ + video.draw(0,0); + if (video.getIsMovieDone()){ + isFinished=true; + } + } } void dirScanner::scan(){ @@ -45,7 +66,7 @@ void dirScanner::scan(){ int start = ofToInt(d.substr(0,4)); int end = ofToInt(d.substr(5,4)); - if (start&&end){ + if (end){ slots.push_back(timeSlot(dir.getPath(i),start,end)); ofLogNotice() << "directory "<