diff --git a/src/camera.cpp b/src/camera.cpp index b9205c7..e172925 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -183,35 +183,23 @@ void DetectLoop::updated(const QString &path) { auto clips = lsFilesInDir(path, shared->streamExt); - if (clips.isEmpty()) + if (clips.size() < 3) { thread()->sleep(5); reset(); } else { - auto latestPath = path + "/" + clips.last(); + vidAPath = shared->buffPath + "/live/" + clips[clips.size() - 3]; + vidBPath = shared->buffPath + "/live/" + clips[clips.size() - 2]; - if (vidAPath.isEmpty()) - { - vidAPath = latestPath; - } - else if (latestPath == vidAPath) - { - thread()->usleep(500); - } - else - { - vidBPath = latestPath; - - thread()->sleep(1); - - exec(); - } + exec(); thread()->sleep(1); } } void DetectLoop::pcBreak() { + prevClips.clear(); + if (!shared->postCmd.isEmpty()) { QTextStream(stdout) << "---POST_BREAK---" << Qt::endl; @@ -370,12 +358,6 @@ void DetectLoop::exec() eventQue.vidList.append(vidBPath); } } - else - { - QTextStream(stdout) << "why?" << Qt::endl; - QTextStream(stdout) << "imgAPath: " << imgAPath << Qt::endl; - QTextStream(stdout) << "imgBPath: " << imgBPath << Qt::endl; - } } vidAPath.clear(); diff --git a/src/camera.h b/src/camera.h index 3b19f67..daaec75 100644 --- a/src/camera.h +++ b/src/camera.h @@ -60,11 +60,12 @@ class DetectLoop : public QFileSystemWatcher private: - QString vidAPath; - QString vidBPath; - QTimer *pcTimer; - evt_t eventQue; - shared_t *shared; + QString vidAPath; + QString vidBPath; + QStringList prevClips; + QTimer *pcTimer; + evt_t eventQue; + shared_t *shared; float getFloatFromExe(const QByteArray &line); QStringList buildArgs(const QString &prev, const QString &next); diff --git a/src/common.h b/src/common.h index ba696e1..6f76f4d 100644 --- a/src/common.h +++ b/src/common.h @@ -30,7 +30,7 @@ using namespace std; -#define APP_VER "3.3.t5" +#define APP_VER "3.3.t6" #define APP_NAME "Motion Watch" #define APP_BIN "mow" #define DATETIME_FMT "yyyyMMddhhmmss"