-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.
This commit is contained in:
Zii 2023-11-19 20:45:22 -05:00
parent 4f0c37b92b
commit 5b444fd754
3 changed files with 13 additions and 30 deletions

View File

@ -183,35 +183,23 @@ void DetectLoop::updated(const QString &path)
{ {
auto clips = lsFilesInDir(path, shared->streamExt); auto clips = lsFilesInDir(path, shared->streamExt);
if (clips.isEmpty()) if (clips.size() < 3)
{ {
thread()->sleep(5); reset(); thread()->sleep(5); reset();
} }
else 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()) exec(); thread()->sleep(1);
{
vidAPath = latestPath;
}
else if (latestPath == vidAPath)
{
thread()->usleep(500);
}
else
{
vidBPath = latestPath;
thread()->sleep(1);
exec();
}
} }
} }
void DetectLoop::pcBreak() void DetectLoop::pcBreak()
{ {
prevClips.clear();
if (!shared->postCmd.isEmpty()) if (!shared->postCmd.isEmpty())
{ {
QTextStream(stdout) << "---POST_BREAK---" << Qt::endl; QTextStream(stdout) << "---POST_BREAK---" << Qt::endl;
@ -370,12 +358,6 @@ void DetectLoop::exec()
eventQue.vidList.append(vidBPath); eventQue.vidList.append(vidBPath);
} }
} }
else
{
QTextStream(stdout) << "why?" << Qt::endl;
QTextStream(stdout) << "imgAPath: " << imgAPath << Qt::endl;
QTextStream(stdout) << "imgBPath: " << imgBPath << Qt::endl;
}
} }
vidAPath.clear(); vidAPath.clear();

View File

@ -60,11 +60,12 @@ class DetectLoop : public QFileSystemWatcher
private: private:
QString vidAPath; QString vidAPath;
QString vidBPath; QString vidBPath;
QTimer *pcTimer; QStringList prevClips;
evt_t eventQue; QTimer *pcTimer;
shared_t *shared; evt_t eventQue;
shared_t *shared;
float getFloatFromExe(const QByteArray &line); float getFloatFromExe(const QByteArray &line);
QStringList buildArgs(const QString &prev, const QString &next); QStringList buildArgs(const QString &prev, const QString &next);

View File

@ -30,7 +30,7 @@
using namespace std; using namespace std;
#define APP_VER "3.3.t5" #define APP_VER "3.3.t6"
#define APP_NAME "Motion Watch" #define APP_NAME "Motion Watch"
#define APP_BIN "mow" #define APP_BIN "mow"
#define DATETIME_FMT "yyyyMMddhhmmss" #define DATETIME_FMT "yyyyMMddhhmmss"