From 56bd855dbb2cea9c40c831de98cac9445aa1fb10 Mon Sep 17 00:00:00 2001 From: Maurice ONeal Date: Fri, 23 Sep 2022 21:50:06 -0400 Subject: [PATCH] v1.3.t2 Update Added a -v command line option to display the application's current version. The application version is now defined in a single a const value called APP_VER so bumping the version number now means updating this single value in common.h. Versioning scheme will now be major.minor.[test_rev]. test_rev will be t1, 2, 3, etc... as updates are pushed to the test branch. all code pushes to master shall bump major or minor and then remove test_rev. Removed the detect loop's motion latching affect so it ONLY calls wrOut if the video clip contains motion. Fixed a bug in the recording loop that fail to create the needed sub-dir before calling FFMPEG. --- README.md | 2 +- src/common.h | 4 ++-- src/main.cpp | 15 +++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 41b16ec..7e8ae86 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The config file is a simple text file that contain parameters that dictate the behavior of the application. Below is an example of a config file with all parameters supported and descriptions of each parameter. ``` -# Motion Watch config file v1.3 +# Motion Watch config file # # note all lines in this config file that starts with a '#' are ignored. # also note to avoid using empty lines. if you're going to need an empty diff --git a/src/common.h b/src/common.h index bc04d95..70568bd 100644 --- a/src/common.h +++ b/src/common.h @@ -33,7 +33,8 @@ using namespace cv; using namespace std; using namespace std::filesystem; -#define BUF_SZ 10 +#define BUF_SZ 10 +#define APP_VER "1.3.t2" struct shared_t { @@ -57,7 +58,6 @@ struct shared_t int blockY; int maxDays; int retCode; - }; string genTmpFile(const string &dirOut, const string &ext, shared_t *share); diff --git a/src/main.cpp b/src/main.cpp index ac341b4..62a9f27 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -26,11 +26,7 @@ void detectLoop(shared_t *share) Rect blockArea; Mat blockImg; - if (share->skipCmd) - { - wrOut(bufFiles[0], share); - } - else if (moDetect(bufFiles[0], &blockArea, &blockImg, share)) + if (moDetect(bufFiles[0], &blockArea, &blockImg, share)) { if (objectInImage(blockImg, blockArea)) { @@ -59,6 +55,8 @@ void recLoop(shared_t *share) { while (rdConf(share)) { + createDirTree(share->buffDir); + auto bufPath = cleanDir(share->buffDir) + "/%03d." + share->vidExt; auto secs = to_string(share->secs); auto limSecs = to_string(share->secs + 3); @@ -87,10 +85,15 @@ int main(int argc, char** argv) if (parseForParam("-h", argc, argv, true) == "true") { - cout << "Motion Watch v1.3" << endl << endl; + cout << "Motion Watch " << APP_VER << endl << endl; cout << "Usage: mow " << endl << endl; cout << "-h : display usage information about this application." << endl; cout << "-c : path to the config file." << endl; + cout << "-v : display the current version." << endl; + } + if (parseForParam("-v", argc, argv, true) == "true") + { + cout << APP_VER << endl; } else if (sharedRes.conf.empty()) {