From 576f125a22e01ad947cff173089efb9c68fb002c Mon Sep 17 00:00:00 2001 From: tim Date: Sun, 14 May 2017 22:25:45 +0100 Subject: dir scanner --- menuApp/src/dirscanner.cpp | 0 menuApp/src/dirscanner.h | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 menuApp/src/dirscanner.cpp create mode 100644 menuApp/src/dirscanner.h diff --git a/menuApp/src/dirscanner.cpp b/menuApp/src/dirscanner.cpp new file mode 100644 index 0000000..e69de29 diff --git a/menuApp/src/dirscanner.h b/menuApp/src/dirscanner.h new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From c31d38915cb6643013223a4ed9b4021b3499d71d Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 19 May 2017 01:00:43 +0100 Subject: making dir scanner --- menuApp/src/dirscanner.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++ menuApp/src/dirscanner.h | 52 ++++++++++++++++++++++++++++++++++++++++++ menuApp/src/ofApp.cpp | 4 ++++ menuApp/src/ofApp.h | 4 ++++ 4 files changed, 117 insertions(+) diff --git a/menuApp/src/dirscanner.cpp b/menuApp/src/dirscanner.cpp index e69de29..5798e55 100644 --- a/menuApp/src/dirscanner.cpp +++ b/menuApp/src/dirscanner.cpp @@ -0,0 +1,57 @@ +#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 "<=time){ + return i; + } + } + return -1; +} + +void dirPlayer::load(){ + +} + +void dirPlayer::draw(){ + +} \ No newline at end of file diff --git a/menuApp/src/dirscanner.h b/menuApp/src/dirscanner.h index e69de29..1e70ed8 100644 --- a/menuApp/src/dirscanner.h +++ b/menuApp/src/dirscanner.h @@ -0,0 +1,52 @@ +#pragma once + +#include "ofMain.h" + +class timeSlot { + public: + timeSlot(std::string _p,int _s,int _e){ + path=_p; + start=_s; + end=_e; + } + string path; + int start; + int end; +}; + +class playItem { + public: + playItem(std::string _n){ + filename=_n; + } + string filename; + ofImage image; + ofVideoPlayer video; + void play(); + void draw(); + bool isFinished(); + float startTime; +}; + +class dirScanner { + //todo: compare each item in vector for reload + public: + dirScanner(std::string _d=""){ + rootdir=_d; + } + int getSlotForTime(int time); + string rootdir; + void scan(); + vector slots; +}; + +class dirPlayer { + public: + dirPlayer(std::string _d){ + playdir=_d; + } + vector items; + string playdir; + void load(); + void draw(); +}; \ No newline at end of file diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp index 8dbf41b..e19e239 100644 --- a/menuApp/src/ofApp.cpp +++ b/menuApp/src/ofApp.cpp @@ -131,6 +131,10 @@ bool ofApp::loadInstagramFeed(){ //-------------------------------------------------------------- void ofApp::setup(){ + Dirscanner=dirScanner("/home/tim/Dropbox/menugrab"); + + Dirscanner.scan(); + /* std::string str ("€"); diff --git a/menuApp/src/ofApp.h b/menuApp/src/ofApp.h index 17a3d93..a85258e 100644 --- a/menuApp/src/ofApp.h +++ b/menuApp/src/ofApp.h @@ -5,6 +5,8 @@ #include "ofxThreadedImageLoader.h" #include "ofxTextSuite.h" +#include "dirscanner.h" + #define IMAGE_SLOTS 5 //#define FACTOR 1.0 //now in config.make #define FONTSIZE 13 @@ -66,6 +68,8 @@ class ofApp : public ofBaseApp{ ofImage background; ofImage overlay; + + dirScanner Dirscanner; }; -- cgit v1.2.3 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/Makefile | 13 +++++ testDir/config.default | 141 +++++++++++++++++++++++++++++++++++++++++++++ testDir/src/dirscanner.cpp | 71 +++++++++++++++++++++++ testDir/src/dirscanner.h | 58 +++++++++++++++++++ testDir/src/main.cpp | 17 ++++++ testDir/src/ofApp.cpp | 89 ++++++++++++++++++++++++++++ testDir/src/ofApp.h | 34 +++++++++++ 7 files changed, 423 insertions(+) create mode 100644 testDir/Makefile create mode 100644 testDir/config.default create mode 100644 testDir/src/dirscanner.cpp create mode 100644 testDir/src/dirscanner.h create mode 100644 testDir/src/main.cpp create mode 100644 testDir/src/ofApp.cpp create mode 100644 testDir/src/ofApp.h diff --git a/testDir/Makefile b/testDir/Makefile new file mode 100644 index 0000000..8d8e4c0 --- /dev/null +++ b/testDir/Makefile @@ -0,0 +1,13 @@ +# Attempt to load a config.make file. +# If none is found, project defaults in config.project.make will be used. +ifneq ($(wildcard config.make),) + include config.make +endif + +# make sure the the OF_ROOT location is defined +ifndef OF_ROOT + OF_ROOT=$(realpath ../../..) +endif + +# call the project makefile! +include $(OF_ROOT)/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk diff --git a/testDir/config.default b/testDir/config.default new file mode 100644 index 0000000..9c956bf --- /dev/null +++ b/testDir/config.default @@ -0,0 +1,141 @@ +################################################################################ +# CONFIGURE PROJECT MAKEFILE (optional) +# This file is where we make project specific configurations. +################################################################################ + +################################################################################ +# OF ROOT +# The location of your root openFrameworks installation +# (default) OF_ROOT = ../../.. +################################################################################ +# OF_ROOT = + +################################################################################ +# PROJECT ROOT +# The location of the project - a starting place for searching for files +# (default) PROJECT_ROOT = . (this directory) +# +################################################################################ +# PROJECT_ROOT = . + +################################################################################ +# PROJECT SPECIFIC CHECKS +# This is a project defined section to create internal makefile flags to +# conditionally enable or disable the addition of various features within +# this makefile. For instance, if you want to make changes based on whether +# GTK is installed, one might test that here and create a variable to check. +################################################################################ +# None + +################################################################################ +# PROJECT EXTERNAL SOURCE PATHS +# These are fully qualified paths that are not within the PROJECT_ROOT folder. +# Like source folders in the PROJECT_ROOT, these paths are subject to +# exlclusion via the PROJECT_EXLCUSIONS list. +# +# (default) PROJECT_EXTERNAL_SOURCE_PATHS = (blank) +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_EXTERNAL_SOURCE_PATHS = + +################################################################################ +# PROJECT EXCLUSIONS +# These makefiles assume that all folders in your current project directory +# and any listed in the PROJECT_EXTERNAL_SOURCH_PATHS are are valid locations +# to look for source code. The any folders or files that match any of the +# items in the PROJECT_EXCLUSIONS list below will be ignored. +# +# Each item in the PROJECT_EXCLUSIONS list will be treated as a complete +# string unless teh user adds a wildcard (%) operator to match subdirectories. +# GNU make only allows one wildcard for matching. The second wildcard (%) is +# treated literally. +# +# (default) PROJECT_EXCLUSIONS = (blank) +# +# Will automatically exclude the following: +# +# $(PROJECT_ROOT)/bin% +# $(PROJECT_ROOT)/obj% +# $(PROJECT_ROOT)/%.xcodeproj +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_EXCLUSIONS = + +################################################################################ +# PROJECT LINKER FLAGS +# These flags will be sent to the linker when compiling the executable. +# +# (default) PROJECT_LDFLAGS = -Wl,-rpath=./libs +# +# Note: Leave a leading space when adding list items with the += operator +# +# Currently, shared libraries that are needed are copied to the +# $(PROJECT_ROOT)/bin/libs directory. The following LDFLAGS tell the linker to +# add a runtime path to search for those shared libraries, since they aren't +# incorporated directly into the final executable application binary. +################################################################################ +# PROJECT_LDFLAGS=-Wl,-rpath=./libs + +################################################################################ +# PROJECT DEFINES +# Create a space-delimited list of DEFINES. The list will be converted into +# CFLAGS with the "-D" flag later in the makefile. +# +# (default) PROJECT_DEFINES = (blank) +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +#PROJECT_DEFINES = FULLSCREEN FACTOR=1.0 + +################################################################################ +# PROJECT CFLAGS +# This is a list of fully qualified CFLAGS required when compiling for this +# project. These CFLAGS will be used IN ADDITION TO the PLATFORM_CFLAGS +# defined in your platform specific core configuration files. These flags are +# presented to the compiler BEFORE the PROJECT_OPTIMIZATION_CFLAGS below. +# +# (default) PROJECT_CFLAGS = (blank) +# +# Note: Before adding PROJECT_CFLAGS, note that the PLATFORM_CFLAGS defined in +# your platform specific configuration file will be applied by default and +# further flags here may not be needed. +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_CFLAGS = + +################################################################################ +# PROJECT OPTIMIZATION CFLAGS +# These are lists of CFLAGS that are target-specific. While any flags could +# be conditionally added, they are usually limited to optimization flags. +# These flags are added BEFORE the PROJECT_CFLAGS. +# +# PROJECT_OPTIMIZATION_CFLAGS_RELEASE flags are only applied to RELEASE targets. +# +# (default) PROJECT_OPTIMIZATION_CFLAGS_RELEASE = (blank) +# +# PROJECT_OPTIMIZATION_CFLAGS_DEBUG flags are only applied to DEBUG targets. +# +# (default) PROJECT_OPTIMIZATION_CFLAGS_DEBUG = (blank) +# +# Note: Before adding PROJECT_OPTIMIZATION_CFLAGS, please note that the +# PLATFORM_OPTIMIZATION_CFLAGS defined in your platform specific configuration +# file will be applied by default and further optimization flags here may not +# be needed. +# +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_OPTIMIZATION_CFLAGS_RELEASE = +# PROJECT_OPTIMIZATION_CFLAGS_DEBUG = + +################################################################################ +# PROJECT COMPILERS +# Custom compilers can be set for CC and CXX +# (default) PROJECT_CXX = (blank) +# (default) PROJECT_CC = (blank) +# Note: Leave a leading space when adding list items with the += operator +################################################################################ +# PROJECT_CXX = +# PROJECT_CC = 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 diff --git a/testDir/src/dirscanner.h b/testDir/src/dirscanner.h new file mode 100644 index 0000000..f78c6d5 --- /dev/null +++ b/testDir/src/dirscanner.h @@ -0,0 +1,58 @@ +#pragma once + +#include "ofMain.h" + +class timeSlot { + public: + timeSlot(std::string _p,int _s,int _e){ + path=_p; + start=_s; + end=_e; + } + string path; + int start; + int end; +}; + +class playItem { + public: + playItem(std::string _n){ + filename=_n; + } + string filename; + ofImage image; + ofVideoPlayer video; + void play(); + void draw(); + bool isFinished(); + float startTime; +}; + +class dirScanner { + //todo: compare each item in vector for reload + public: + dirScanner(std::string _d=""){ + rootdir=_d; + } + int getSlotForTime(); + string rootdir; + void scan(); + vector slots; +}; + +class dirPlayer { + public: + dirPlayer(){ + currentslot=-1; + } + dirPlayer(dirScanner *_s){ + scanner=_s; + dirPlayer(); + } + vector items; + string playdir; + int currentslot; + dirScanner *scanner; + void load(); + void draw(); +}; \ No newline at end of file diff --git a/testDir/src/main.cpp b/testDir/src/main.cpp new file mode 100644 index 0000000..c8c5551 --- /dev/null +++ b/testDir/src/main.cpp @@ -0,0 +1,17 @@ +#include "ofMain.h" +#include "ofApp.h" + +//======================================================================== +int main( ){ + +#ifdef FULLSCREEN + ofSetupOpenGL(256,256,OF_FULLSCREEN); +#else + ofSetupOpenGL(256,256,OF_WINDOW); // <-------- setup the GL context +#endif + // this kicks off the running of my app + // can be OF_WINDOW or OF_FULLSCREEN + // pass in width and height too: + ofRunApp( new ofApp()); + +} diff --git a/testDir/src/ofApp.cpp b/testDir/src/ofApp.cpp new file mode 100644 index 0000000..d6fdd4b --- /dev/null +++ b/testDir/src/ofApp.cpp @@ -0,0 +1,89 @@ +#include "ofApp.h" + + +//-------------------------------------------------------------- +void ofApp::setup(){ + + scanner=dirScanner(ofFilePath().getUserHomeDir()+"/Dropbox/menugrab"); + + scanner.scan(); + + player=dirPlayer(&scanner); + + ofSetFrameRate(1); +} + +//-------------------------------------------------------------- +void ofApp::update(){ + //ofBackground(255); +} + + +//-------------------------------------------------------------- +void ofApp::draw(){ + ofSetColor(255,255,255); + + + player.draw(); + +} + +//-------------------------------------------------------------- +void ofApp::keyPressed(int key){ + +} + +//-------------------------------------------------------------- +void ofApp::keyReleased(int key){ + +} + +//-------------------------------------------------------------- +void ofApp::mouseMoved(int x, int y){ + +} + +//-------------------------------------------------------------- +void ofApp::mouseDragged(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void ofApp::mousePressed(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void ofApp::mouseReleased(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void ofApp::mouseEntered(int x, int y){ + +} + +//-------------------------------------------------------------- +void ofApp::mouseExited(int x, int y){ + +} + +//-------------------------------------------------------------- +void ofApp::windowResized(int w, int h){ + +} + +//-------------------------------------------------------------- +void ofApp::gotMessage(ofMessage msg){ + +} + +//-------------------------------------------------------------- +void ofApp::dragEvent(ofDragInfo dragInfo){ + +} +//-------------------------------------------------------------- +void ofApp::exit() +{ + +} diff --git a/testDir/src/ofApp.h b/testDir/src/ofApp.h new file mode 100644 index 0000000..2b6ed7d --- /dev/null +++ b/testDir/src/ofApp.h @@ -0,0 +1,34 @@ +#pragma once + +#include "ofMain.h" + +#include "dirscanner.h" + + + +class ofApp : public ofBaseApp{ + + public: + + void setup(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void mouseMoved(int x, int y); + void mouseDragged(int x, int y, int button); + void mousePressed(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void mouseEntered(int x, int y); + void mouseExited(int x, int y); + void windowResized(int w, int h); + void dragEvent(ofDragInfo dragInfo); + void gotMessage(ofMessage msg); + void exit(); + + dirScanner scanner; + dirPlayer player; +}; + + -- 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(-) 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(-) 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(-) 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 "<