From 71df7d1eb568ec74afea8a63a342fdf50d39e2c0 Mon Sep 17 00:00:00 2001 From: Zii Date: Tue, 30 May 2023 20:03:22 -0400 Subject: [PATCH] v3.0.t10 -turns out the previous statment on the previous commit is incorrect. it is every possible to overlap events. to mitigate this, evtHist was added to shared_t to track recently copied source vids and remove them from the event queued to be written. --- src/camera.cpp | 40 +++++++++++++++++++++++++++++----------- src/common.h | 4 +++- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index d7e110a..8692f77 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -242,6 +242,11 @@ bool Upkeep::exec() enforceMaxEvents(shared); enforceMaxImages(); + if (shared->evtHist.size() >= MAX_EVTHIST) + { + shared->evtHist.clear(); + } + genHTMLul(".", shared->camName, shared); genCSS(shared); @@ -273,21 +278,34 @@ bool EventLoop::exec() vidList += forwardFacingFiles("live", ".ts", event.timeStamp, shared->evMaxSecs / 2); - recLog("attempting write out of event: " + name, shared); - - if (wrOutVod(name, vidList)) + for (auto &&hist : shared->evtHist) { - genHTMLvod(name); + if (vidList.contains(hist)) + { + vidList.removeAll(hist); + } + } - QProcess proc; - QStringList args; + if (!vidList.isEmpty()) + { + shared->evtHist.append(vidList); - args << "convert"; - args << event.imgPath; - args << "events/" + name + ".jpg"; + recLog("attempting write out of event: " + name, shared); - proc.start("magick", args); - proc.waitForFinished(); + if (wrOutVod(name, vidList)) + { + genHTMLvod(name); + + QProcess proc; + QStringList args; + + args << "convert"; + args << event.imgPath; + args << "events/" + name + ".jpg"; + + proc.start("magick", args); + proc.waitForFinished(); + } } } diff --git a/src/common.h b/src/common.h index 3eab771..beec681 100644 --- a/src/common.h +++ b/src/common.h @@ -28,7 +28,7 @@ using namespace std; -#define APP_VER "3.0.t9" +#define APP_VER "3.0.t10" #define APP_NAME "Motion Watch" #define APP_BIN "mow" #define REC_LOG_NAME "rec_log_lines.html" @@ -37,6 +37,7 @@ using namespace std; #define DATETIME_FMT "yyyyMMddhhmmss" #define STRFTIME_FMT "%Y%m%d%H%M%S" #define MAX_IMAGES 1000 +#define MAX_EVTHIST 100 struct evt_t { @@ -47,6 +48,7 @@ struct evt_t struct shared_t { QList recList; + QStringList evtHist; QString conf; QString recLog; QString detLog;