diff --git a/src/camera.cpp b/src/camera.cpp index e172925..69c25c6 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -167,9 +167,6 @@ void DetectLoop::init() void DetectLoop::reset() { - vidAPath.clear(); - vidBPath.clear(); - eventQue.inQue = false; eventQue.score = 0; eventQue.queAge = 0; @@ -182,15 +179,19 @@ void DetectLoop::reset() void DetectLoop::updated(const QString &path) { auto clips = lsFilesInDir(path, shared->streamExt); + auto index = clips.indexOf(vidBName); - if (clips.size() < 3) + if (clips.size() - (index + 1) < 3) { - thread()->sleep(5); reset(); + thread()->sleep(1); } else { - vidAPath = shared->buffPath + "/live/" + clips[clips.size() - 3]; - vidBPath = shared->buffPath + "/live/" + clips[clips.size() - 2]; + vidAName = clips[clips.size() - 3]; + vidBName = clips[clips.size() - 2]; + + vidAPath = shared->buffPath + "/live/" + vidAName; + vidBPath = shared->buffPath + "/live/" + vidBName; exec(); thread()->sleep(1); } diff --git a/src/camera.h b/src/camera.h index daaec75..6a2440d 100644 --- a/src/camera.h +++ b/src/camera.h @@ -62,6 +62,8 @@ private: QString vidAPath; QString vidBPath; + QString vidAName; + QString vidBName; QStringList prevClips; QTimer *pcTimer; evt_t eventQue; diff --git a/src/common.h b/src/common.h index 6f76f4d..a311dc7 100644 --- a/src/common.h +++ b/src/common.h @@ -30,7 +30,7 @@ using namespace std; -#define APP_VER "3.3.t6" +#define APP_VER "3.3.t7" #define APP_NAME "Motion Watch" #define APP_BIN "mow" #define DATETIME_FMT "yyyyMMddhhmmss"