提交 942115d7 authored 作者: blu's avatar blu

big refacting of communitation architect

上级 697a290a
...@@ -7,3 +7,6 @@ ...@@ -7,3 +7,6 @@
[submodule "opencv-motion-detect/vendor/curl"] [submodule "opencv-motion-detect/vendor/curl"]
path = opencv-motion-detect/vendor/curl path = opencv-motion-detect/vendor/curl
url = https://github.com/curl/curl url = https://github.com/curl/curl
[submodule "opencv-motion-detect/vendor/fswatch"]
path = opencv-motion-detect/vendor/fswatch
url = https://github.com/emcrisostomo/fswatch
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
"${workspaceFolder}/opencv-motion-detect/vendor/include/**", "${workspaceFolder}/opencv-motion-detect/vendor/include/**",
"/usr/local/Cellar/opencv/4.1.0_2/include/opencv4", "/usr/local/Cellar/opencv/4.1.0_2/include/opencv4",
"/usr/local/Cellar/ffmpeg/4.1.4_1/include", "/usr/local/Cellar/ffmpeg/4.1.4_1/include",
"vendor/include",
"vendor/include/**",
"${workspaceFolder}/opencv-motion-detect/vendor/leveldb/include" "${workspaceFolder}/opencv-motion-detect/vendor/leveldb/include"
], ],
"defines": [], "defines": [],
......
#include "dirmon.h"
using namespace std;
using namespace fsw;
void fileEventHandler(const std::vector<event>&evts, void *pUser){
for(auto&i:evts) {
spdlog::info("path: {}, time: {}", i.get_path(), i.get_time());
}
}
int CreateDirMon(monitor **m, string path, string ext, vector<string> &&events, FSW_EVENT_CALLBACK cb){
vector<string> paths= {path};
vector<fsw_event_type_filter> event_filters = {{fsw_event_flag::Created}};
*m = monitor_factory::create_monitor(
fsw_monitor_type::system_default_monitor_type,
paths,
fileEventHandler);
(*m)->start();
return 0;
}
int CloseDirMon(){
}
#define DEBUG
#ifdef DEBUG
int main(){
monitor *mon = nullptr;
CreateDirMon(&mon, "./slices", ".mp4", vector<string>(), nullptr);
}
#endif
\ No newline at end of file
#ifndef __EV_DIR_MON_H__
#define __EV_DIR_MON_H__
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include "libfswatch/c++/path_utils.hpp"
#include "libfswatch/c++/event.hpp"
#include "libfswatch/c++/monitor.hpp"
#include "libfswatch/c++/monitor_factory.hpp"
#include "libfswatch/c++/libfswatch_exception.hpp"
#include "inc/spdlog/spdlog.h"
#endif
\ No newline at end of file
...@@ -48,6 +48,7 @@ vector<long> LoadVideoFiles(string path, int days, int maxSlices, map<long, stri ...@@ -48,6 +48,7 @@ vector<long> LoadVideoFiles(string path, int days, int maxSlices, map<long, stri
spdlog::warn("LoasdVideoFiles skipped {} (empty/directory/!mp4)", entry.path().c_str()); spdlog::warn("LoasdVideoFiles skipped {} (empty/directory/!mp4)", entry.path().c_str());
continue; continue;
} }
auto ftime = fs::last_write_time(entry.path()); auto ftime = fs::last_write_time(entry.path());
auto ts = decltype(ftime)::clock::to_time_t(ftime); auto ts = decltype(ftime)::clock::to_time_t(ftime);
...@@ -99,7 +100,6 @@ vector<long> LoadVideoFiles(string path, int days, int maxSlices, map<long, stri ...@@ -99,7 +100,6 @@ vector<long> LoadVideoFiles(string path, int days, int maxSlices, map<long, stri
int main(int argc, const char *argv[]) int main(int argc, const char *argv[])
{ {
std::string path = argv[1]; std::string path = argv[1];
list<long> tsRing; list<long> tsRing;
list<long> tsProcess; list<long> tsProcess;
...@@ -108,7 +108,7 @@ int main(int argc, const char *argv[]) ...@@ -108,7 +108,7 @@ int main(int argc, const char *argv[])
auto v = LoadVideoFiles(path, 2, 3, ts2fileName, tsRing, tsProcess); auto v = LoadVideoFiles(path, 2, 3, ts2fileName, tsRing, tsProcess);
for(auto &i:v) { for(auto &i:v) {
spdlog::info("tsRing: {} file: {}", i, ts2fileName[i]); spdlog::info("tsRing: {} File: {}", i, ts2fileName[i]);
} }
return 0; return 0;
......
Subproject commit 18aacf1b4a2ed99513692027eac2c32cf9d7df2d
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论