|
@ -17,15 +17,15 @@ namespace piMapper { |
|
|
|
|
|
|
|
|
class BasePathFilter : public ofx::IO::AbstractPathFilter { |
|
|
class BasePathFilter : public ofx::IO::AbstractPathFilter { |
|
|
public: |
|
|
public: |
|
|
BasePathFilter() {}; |
|
|
BasePathFilter(){} |
|
|
virtual ~BasePathFilter() {}; |
|
|
virtual ~BasePathFilter(){} |
|
|
virtual bool accept(const Poco::Path& path) const {}; |
|
|
virtual bool accept(const Poco::Path & path) const {} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class VideoPathFilter : public BasePathFilter { |
|
|
class VideoPathFilter : public BasePathFilter { |
|
|
public: |
|
|
public: |
|
|
VideoPathFilter() {}; |
|
|
VideoPathFilter(){} |
|
|
virtual ~VideoPathFilter() {}; |
|
|
virtual ~VideoPathFilter(){} |
|
|
|
|
|
|
|
|
bool accept(const Poco::Path & path) const { |
|
|
bool accept(const Poco::Path & path) const { |
|
|
return !Poco::File(path).isHidden() && |
|
|
return !Poco::File(path).isHidden() && |
|
@ -39,8 +39,8 @@ class VideoPathFilter : public BasePathFilter { |
|
|
|
|
|
|
|
|
class ImagePathFilter : public BasePathFilter { |
|
|
class ImagePathFilter : public BasePathFilter { |
|
|
public: |
|
|
public: |
|
|
ImagePathFilter() {}; |
|
|
ImagePathFilter(){} |
|
|
virtual ~ImagePathFilter() {}; |
|
|
virtual ~ImagePathFilter(){} |
|
|
|
|
|
|
|
|
bool accept(const Poco::Path & path) const { |
|
|
bool accept(const Poco::Path & path) const { |
|
|
return !Poco::File(path).isHidden() && |
|
|
return !Poco::File(path).isHidden() && |
|
@ -56,8 +56,7 @@ class DirectoryWatcher { |
|
|
~DirectoryWatcher(); |
|
|
~DirectoryWatcher(); |
|
|
|
|
|
|
|
|
// TODO make useful stuff with onDirectoryWatcher*
|
|
|
// TODO make useful stuff with onDirectoryWatcher*
|
|
|
void onDirectoryWatcherItemAdded( |
|
|
void onDirectoryWatcherItemAdded(const ofx::IO::DirectoryWatcherManager::DirectoryEvent & evt){ |
|
|
const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) { |
|
|
|
|
|
string path = evt.item.path(); |
|
|
string path = evt.item.path(); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
if(!filter->accept(pocoPath)){ |
|
|
if(!filter->accept(pocoPath)){ |
|
@ -67,8 +66,7 @@ class DirectoryWatcher { |
|
|
ofNotifyEvent(onItemAdded, path, this); |
|
|
ofNotifyEvent(onItemAdded, path, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void onDirectoryWatcherItemRemoved( |
|
|
void onDirectoryWatcherItemRemoved(const ofx::IO::DirectoryWatcherManager::DirectoryEvent & evt){ |
|
|
const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) { |
|
|
|
|
|
string path = evt.item.path(); |
|
|
string path = evt.item.path(); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
if(!filter->accept(pocoPath)){ |
|
|
if(!filter->accept(pocoPath)){ |
|
@ -84,8 +82,7 @@ class DirectoryWatcher { |
|
|
ofNotifyEvent(onItemRemoved, path, this); |
|
|
ofNotifyEvent(onItemRemoved, path, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void onDirectoryWatcherItemModified( |
|
|
void onDirectoryWatcherItemModified(const ofx::IO::DirectoryWatcherManager::DirectoryEvent & evt){ |
|
|
const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) { |
|
|
|
|
|
string path = evt.item.path(); |
|
|
string path = evt.item.path(); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
if(!filter->accept(pocoPath)){ |
|
|
if(!filter->accept(pocoPath)){ |
|
@ -94,8 +91,7 @@ class DirectoryWatcher { |
|
|
ofNotifyEvent(onItemModified, path, this); |
|
|
ofNotifyEvent(onItemModified, path, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void onDirectoryWatcherItemMovedFrom( |
|
|
void onDirectoryWatcherItemMovedFrom(const ofx::IO::DirectoryWatcherManager::DirectoryEvent & evt){ |
|
|
const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) { |
|
|
|
|
|
string path = evt.item.path(); |
|
|
string path = evt.item.path(); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
if(!filter->accept(pocoPath)){ |
|
|
if(!filter->accept(pocoPath)){ |
|
@ -106,8 +102,7 @@ class DirectoryWatcher { |
|
|
ofNotifyEvent(onItemMovedFrom, path, this); |
|
|
ofNotifyEvent(onItemMovedFrom, path, this); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void onDirectoryWatcherItemMovedTo( |
|
|
void onDirectoryWatcherItemMovedTo(const ofx::IO::DirectoryWatcherManager::DirectoryEvent & evt){ |
|
|
const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) { |
|
|
|
|
|
string path = evt.item.path(); |
|
|
string path = evt.item.path(); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
Poco::Path pocoPath = Poco::Path(path); |
|
|
if(!filter->accept(pocoPath)){ |
|
|
if(!filter->accept(pocoPath)){ |
|
@ -140,5 +135,6 @@ class DirectoryWatcher { |
|
|
std::vector <std::string> filePaths; |
|
|
std::vector <std::string> filePaths; |
|
|
int mediaType; |
|
|
int mediaType; |
|
|
}; |
|
|
}; |
|
|
} |
|
|
|
|
|
} |
|
|
} // namespace piMapper
|
|
|
|
|
|
} // namespace ofx
|