From 5b444fd7547b5c1c5071531526129d993346fdc4 Mon Sep 17 00:00:00 2001 From: Zii Date: Sun, 19 Nov 2023 20:45:22 -0500 Subject: [PATCH] v3.3.t6 -detectloop now operates on a minimum of 3 clips and then grabs only the second and third to last clips. this insures only finished clips from the stream are grabbed. --- src/camera.cpp | 30 ++++++------------------------ src/camera.h | 11 ++++++----- src/common.h | 2 +- 3 files changed, 13 insertions(+), 30 deletions(-) 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"