Browse Source

added getPaths

master
Felix Dubrownik 11 years ago
parent
commit
9d3733bb66
  1. 6
      example/src/ofApp.cpp
  2. 1
      src/MediaServer/DirectoryWatcher.h
  3. 7
      src/MediaServer/MediaServer.cpp
  4. 5
      src/MediaServer/MediaServer.h

6
example/src/ofApp.cpp

@ -28,6 +28,12 @@ void ofApp::setup() {
} }
ofLog() << "Number of Images: " << mediaServer.getNumImages(); ofLog() << "Number of Images: " << mediaServer.getNumImages();
ofLog() << "Number of Videos: " << mediaServer.getNumVideos(); ofLog() << "Number of Videos: " << mediaServer.getNumVideos();
for (auto s : mediaServer.getImagePaths()) {
ofLog() << s;
}
for (auto s : mediaServer.getVideoPaths()) {
ofLog() << s;
}
} }
void ofApp::update() { void ofApp::update() {

1
src/MediaServer/DirectoryWatcher.h

@ -20,6 +20,7 @@ class CustomPathFilter : public ofx::IO::AbstractPathFilter {
virtual ~CustomPathFilter() {}; virtual ~CustomPathFilter() {};
virtual bool accept(const Poco::Path& path) const {}; virtual bool accept(const Poco::Path& path) const {};
}; };
class CustomVideoPathFilter : public CustomPathFilter { class CustomVideoPathFilter : public CustomPathFilter {
public: public:
CustomVideoPathFilter() {}; CustomVideoPathFilter() {};

7
src/MediaServer/MediaServer.cpp

@ -19,5 +19,12 @@ MediaServer::~MediaServer() {};
int MediaServer::getNumImages() { return imageWatcher.filePaths.size(); } int MediaServer::getNumImages() { return imageWatcher.filePaths.size(); }
int MediaServer::getNumVideos() { return videoWatcher.filePaths.size(); } int MediaServer::getNumVideos() { return videoWatcher.filePaths.size(); }
std::vector<std::string>& MediaServer::getImagePaths() {
return imageWatcher.filePaths;
}
std::vector<std::string>& MediaServer::getVideoPaths() {
return videoWatcher.filePaths;
}
} }
} }

5
src/MediaServer/MediaServer.h

@ -24,11 +24,12 @@ class MediaServer {
int getNumVideos(); int getNumVideos();
int getNumImages(); int getNumImages();
std::vector<string>& getVideoPaths();
std::vector<string>& getImagePaths();
private: private:
// Video // Directory Watchers
ofx::piMapper::DirectoryWatcher videoWatcher; ofx::piMapper::DirectoryWatcher videoWatcher;
// Images
ofx::piMapper::DirectoryWatcher imageWatcher; ofx::piMapper::DirectoryWatcher imageWatcher;
}; };
} }

Loading…
Cancel
Save