v3.0.t15
-changed up the logic in EventLoop to better honer maxEventSecs and pick the highest scoring event as the event name and thumbnail.
This commit is contained in:
parent
baf0b86610
commit
51218198b5
|
@ -267,54 +267,63 @@ bool Upkeep::exec()
|
||||||
EventLoop::EventLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : Loop(sharedRes, thr, parent)
|
EventLoop::EventLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : Loop(sharedRes, thr, parent)
|
||||||
{
|
{
|
||||||
heartBeat = 2;
|
heartBeat = 2;
|
||||||
|
highScore = 0;
|
||||||
|
cycles = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EventLoop::exec()
|
bool EventLoop::exec()
|
||||||
{
|
{
|
||||||
QStringList vidList;
|
if (cycles * 2 >= shared->evMaxSecs)
|
||||||
QString imgPath;
|
|
||||||
QString name;
|
|
||||||
float highScore = 0;
|
|
||||||
|
|
||||||
while (!shared->recList.isEmpty())
|
|
||||||
{
|
{
|
||||||
auto event = shared->recList[0];
|
vidList.removeDuplicates();
|
||||||
auto maxFiles = shared->evMaxSecs / 2;
|
|
||||||
// there's 2 secs in each hls segment
|
|
||||||
|
|
||||||
if (highScore < event.score)
|
if (!vidList.size() > 1)
|
||||||
{
|
{
|
||||||
name = event.timeStamp.toString(DATETIME_FMT);
|
recLog("attempting write out of event: " + name, shared);
|
||||||
imgPath = event.imgPath;
|
|
||||||
highScore = event.score;
|
if (wrOutVod(name, vidList))
|
||||||
|
{
|
||||||
|
genHTMLvod(name);
|
||||||
|
|
||||||
|
QProcess proc;
|
||||||
|
QStringList args;
|
||||||
|
|
||||||
|
args << "convert";
|
||||||
|
args << imgPath;
|
||||||
|
args << "events/" + name + ".jpg";
|
||||||
|
|
||||||
|
proc.start("magick", args);
|
||||||
|
proc.waitForFinished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vidList.append(backwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
cycles = 0;
|
||||||
vidList.removeLast();
|
highScore = 0;
|
||||||
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
|
||||||
|
|
||||||
shared->recList.removeFirst();
|
vidList.clear();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
vidList.removeDuplicates();
|
|
||||||
|
|
||||||
if (!vidList.size() > 1)
|
|
||||||
{
|
{
|
||||||
recLog("attempting write out of event: " + name, shared);
|
cycles += 1;
|
||||||
|
|
||||||
if (wrOutVod(name, vidList))
|
while (!shared->recList.isEmpty())
|
||||||
{
|
{
|
||||||
genHTMLvod(name);
|
auto event = shared->recList[0];
|
||||||
|
auto maxFiles = shared->evMaxSecs / 2;
|
||||||
|
// there's 2 secs in each hls segment
|
||||||
|
|
||||||
QProcess proc;
|
if (highScore < event.score)
|
||||||
QStringList args;
|
{
|
||||||
|
name = event.timeStamp.toString(DATETIME_FMT);
|
||||||
|
imgPath = event.imgPath;
|
||||||
|
highScore = event.score;
|
||||||
|
}
|
||||||
|
|
||||||
args << "convert";
|
vidList.append(backwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
||||||
args << imgPath;
|
vidList.removeLast();
|
||||||
args << "events/" + name + ".jpg";
|
vidList.append(forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2));
|
||||||
|
|
||||||
proc.start("magick", args);
|
shared->recList.removeFirst();
|
||||||
proc.waitForFinished();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,8 +494,6 @@ bool DetectLoop::exec()
|
||||||
event.score = score;
|
event.score = score;
|
||||||
event.imgPath = images[pos];
|
event.imgPath = images[pos];
|
||||||
|
|
||||||
delayCycles = (shared->evMaxSecs / 2) - 1;
|
|
||||||
|
|
||||||
shared->recList.append(event); mod = true;
|
shared->recList.append(event); mod = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,12 @@ class EventLoop : public Loop
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
QStringList vidList;
|
||||||
|
QString imgPath;
|
||||||
|
QString name;
|
||||||
|
float highScore;
|
||||||
|
uint cycles;
|
||||||
|
|
||||||
bool wrOutVod(const QString &name, const QStringList &vids);
|
bool wrOutVod(const QString &name, const QStringList &vids);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define APP_VER "3.0.t14"
|
#define APP_VER "3.0.t15"
|
||||||
#define APP_NAME "Motion Watch"
|
#define APP_NAME "Motion Watch"
|
||||||
#define APP_BIN "mow"
|
#define APP_BIN "mow"
|
||||||
#define REC_LOG_NAME "rec_log_lines.html"
|
#define REC_LOG_NAME "rec_log_lines.html"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user