From 4c351a6c540373425f084f275726aee5072ab4a2 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 14 Dec 2021 09:39:29 -0500
Subject: [PATCH 01/15] When orig.tar.bz2 doesn't exist, just create it without
asking
---
utils/do_debian_package.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh
index 00dcd44e9..efe16401b 100755
--- a/utils/do_debian_package.sh
+++ b/utils/do_debian_package.sh
@@ -223,6 +223,8 @@ if [ -e "$DIRECTORY.orig.tar.gz" ]; then
if [[ "$REPLY" == "" || "$REPLY" == [yY] ]]; then
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
fi;
+else
+ tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
fi;
IFS=',' ;for DISTRO in `echo "$DISTROS"`; do
From 80166a1ab54eeb42989c9cecd3ba21bbad94fa75 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Wed, 22 Dec 2021 11:25:46 -0500
Subject: [PATCH 02/15] Fix preset labels not being populated and causing
javascript errors when they are.
---
web/skins/classic/views/js/watch.js.php | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php
index 04a6c0757..be8065d12 100644
--- a/web/skins/classic/views/js/watch.js.php
+++ b/web/skins/classic/views/js/watch.js.php
@@ -60,16 +60,16 @@ var mode = "";
var monitorData = new Array();
monitorData[monitorData.length] = {
- 'id': Id() ?>,
- 'width': ViewWidth() ?>,
- 'height':ViewHeight() ?>,
- 'url': 'UrlToIndex() ?>',
- 'onclick': function(){window.location.assign( '?view=watch&mid=Id() ?>' );},
- 'type': 'Type() ?>',
- 'refresh': 'Refresh() ?>'
+ 'id': Id() ?>,
+ 'width': ViewWidth() ?>,
+ 'height':ViewHeight() ?>,
+ 'url': 'UrlToIndex() ?>',
+ 'onclick': function(){window.location.assign( '?view=watch&mid=Id() ?>' );},
+ 'type': 'Type() ?>',
+ 'refresh': 'Refresh() ?>'
};
;
var labels = new Array();
Id())) as $row) {
$label = $labels[$row['Preset']] = $row['Label'];
- echo 'labels['. validInt($index) .'] = \''.validJsStr($label).'\'';
+ echo 'labels['. validInt($row['Preset']) .'] = \''.validJsStr($label).'\';'.PHP_EOL;
}
?>
var deleteString = "";
From 185dc4a50d9c3e9b7774579b31073b5ce5305f7d Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Wed, 22 Dec 2021 11:28:00 -0500
Subject: [PATCH 03/15] Do a git pull instead of fetch so as to actually get
the changes
---
utils/do_debian_package.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh
index efe16401b..f20ee6183 100755
--- a/utils/do_debian_package.sh
+++ b/utils/do_debian_package.sh
@@ -119,8 +119,8 @@ if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then
if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then
echo "Using local clone ${GITHUB_FORK}_ZoneMinder.git to pull from."
cd "${GITHUB_FORK}_ZoneMinder.git"
- echo "git fetch..."
- git fetch
+ echo "git pull..."
+ git pull
cd ../
echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release"
From 2aacbf790af051c95a804603bddec0cabd169c82 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 21 Dec 2021 20:24:28 -0500
Subject: [PATCH 04/15] handle warning due to not defined last_run
---
scripts/zmfilter.pl.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in
index c0cdf7235..960c090cb 100644
--- a/scripts/zmfilter.pl.in
+++ b/scripts/zmfilter.pl.in
@@ -184,7 +184,7 @@ while (!$zm_terminate) {
foreach my $filter (@filters) {
last if $zm_terminate;
- my $elapsed = ($now - $$filter{last_ran});
+ my $elapsed = ($now - ($$filter{last_ran} ? $$filter{last_ran} : 0));
if ($$filter{last_ran} and ($elapsed < $$filter{ExecuteInterval})) {
my $filter_delay = $$filter{ExecuteInterval} - ($now - $$filter{last_ran});
$delay = $filter_delay if $filter_delay < $delay;
From bdcb7950cdc98857868a6a7ecb9a374e4d19db78 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Sun, 26 Dec 2021 11:51:22 -0500
Subject: [PATCH 05/15] Fix export from event view due to conflict with
function name in skin.js
---
web/skins/classic/views/js/event.js | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js
index 04bf66b7e..2c03dd9ca 100644
--- a/web/skins/classic/views/js/event.js
+++ b/web/skins/classic/views/js/event.js
@@ -710,10 +710,6 @@ function renameEvent() {
actQuery('rename', {eventName: newName});
}
-function exportEvent() {
- window.location.assign('?view=export&eids[]='+eventData.Id);
-}
-
function showEventFrames() {
window.location.assign('?view=frames&eid='+eventData.Id);
}
@@ -1020,11 +1016,11 @@ function initPage() {
// Manage the EXPORT button
bindButton('#exportBtn', 'click', null, function onExportClick(evt) {
evt.preventDefault();
- exportEvent();
+ window.location.assign('?view=export&eids[]='+eventData.Id);
});
// Manage the generateVideo button
- bindButton('#videoBtn', 'click', null, function onExportClick(evt) {
+ bindButton('#videoBtn', 'click', null, function onVideoClick(evt) {
evt.preventDefault();
videoEvent();
});
From f9f87645077cc9d1893bd69f9fd7c568e275e498 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 12:30:16 -0500
Subject: [PATCH 06/15] Change Event->Cause to a TEXT instead of varchar(32)
because we now inclue Alarmed Zone name and could include other info as well.
Fixes #3403
---
db/zm_create.sql.in | 2 +-
db/zm_update-1.37.7.sql | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 db/zm_update-1.37.7.sql
diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in
index fbc7cad3c..72b0be56f 100644
--- a/db/zm_create.sql.in
+++ b/db/zm_create.sql.in
@@ -188,7 +188,7 @@ CREATE TABLE `Events` (
`StorageId` smallint(5) unsigned default 0,
`SecondaryStorageId` smallint(5) unsigned default 0,
`Name` varchar(64) NOT NULL default '',
- `Cause` varchar(32) NOT NULL default '',
+ `Cause` TEXT,
`StartDateTime` datetime default NULL,
`EndDateTime` datetime default NULL,
`Width` smallint(5) unsigned NOT NULL default '0',
diff --git a/db/zm_update-1.37.7.sql b/db/zm_update-1.37.7.sql
new file mode 100644
index 000000000..7d45f67c6
--- /dev/null
+++ b/db/zm_update-1.37.7.sql
@@ -0,0 +1,2 @@
+/* Change Cause from varchar(32) to TEXT. We now include alarmed zone name */
+ALTER TABLE `Events` MODIFY `Cause` TEXT;
From 0e148d809abc9d78024ae3bc9ec6ac42289e11d0 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 12:33:23 -0500
Subject: [PATCH 07/15] cleanup logic and fix the zone names coming before the
Motion: label
---
src/zm_monitor.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp
index fff655177..c4e82a69a 100644
--- a/src/zm_monitor.cpp
+++ b/src/zm_monitor.cpp
@@ -1894,16 +1894,14 @@ bool Monitor::Analyse() {
alarm_cause += std::string(zone.Label());
}
}
- if (!alarm_cause.empty())
- cause = cause+" "+alarm_cause;
-
Debug(3, "After motion detection, score:%d last_motion_score(%d), new motion score(%d)",
score, last_motion_score, motion_score);
motion_frame_count += 1;
last_motion_score = motion_score;
+
if (motion_score) {
if (cause.length()) cause += ", ";
- cause += MOTION_CAUSE;
+ cause += MOTION_CAUSE+":"+alarm_cause;
noteSetMap[MOTION_CAUSE] = zoneSet;
} // end if motion_score
}
From e81384bba4c49ec55e67842ec64e573c0bb9cd7b Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 12:45:02 -0500
Subject: [PATCH 08/15] Fix fail to build
---
src/zm_monitor.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp
index c4e82a69a..ac2703b71 100644
--- a/src/zm_monitor.cpp
+++ b/src/zm_monitor.cpp
@@ -1901,7 +1901,7 @@ bool Monitor::Analyse() {
if (motion_score) {
if (cause.length()) cause += ", ";
- cause += MOTION_CAUSE+":"+alarm_cause;
+ cause += MOTION_CAUSE+std::string(":")+alarm_cause;
noteSetMap[MOTION_CAUSE] = zoneSet;
} // end if motion_score
}
From 87962a3723189c1cfa53b9f9ed21196eba50a453 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 13:48:37 -0500
Subject: [PATCH 09/15] Invert Importance so that Normal is the auto-selected
first value
---
web/skins/classic/views/monitor.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php
index 657c2ce8c..fe3cc9950 100644
--- a/web/skins/classic/views/monitor.php
+++ b/web/skins/classic/views/monitor.php
@@ -1286,9 +1286,9 @@ echo htmlSelect('newMonitor[ReturnLocation]', $return_options, $monitor->ReturnL
translate('Not important'),
- 'Less'=>translate('Less important'),
'Normal'=>translate('Normal')
+ 'Less'=>translate('Less important'),
+ 'Not'=>translate('Not important'),
), $monitor->Importance());
?>
From 46b95e28ec21b871861649e876fd8b64fff0587f Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 13:51:36 -0500
Subject: [PATCH 10/15] Fix commas
---
web/skins/classic/views/monitor.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php
index fe3cc9950..bfb0638c9 100644
--- a/web/skins/classic/views/monitor.php
+++ b/web/skins/classic/views/monitor.php
@@ -1286,9 +1286,9 @@ echo htmlSelect('newMonitor[ReturnLocation]', $return_options, $monitor->ReturnL
translate('Normal')
+ 'Normal'=>translate('Normal'),
'Less'=>translate('Less important'),
- 'Not'=>translate('Not important'),
+ 'Not'=>translate('Not important')
), $monitor->Importance());
?>
From e7a33a3dbed4a30a35970778bf4981c603367f68 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 13:51:47 -0500
Subject: [PATCH 11/15] Add Importance to monitors view
---
web/skins/classic/views/monitors.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/web/skins/classic/views/monitors.php b/web/skins/classic/views/monitors.php
index db02d92d5..fb63e09fa 100644
--- a/web/skins/classic/views/monitors.php
+++ b/web/skins/classic/views/monitors.php
@@ -86,6 +86,17 @@ The following monitors will have these settings update when you click Save:
Enabled()) ) { ?> checked="checked"/>
+
+
+translate('Normal'),
+ 'Less'=>translate('Less important'),
+ 'Not'=>translate('Not important')
+ ), $monitor->Importance());
+?>
+
From 5933aa8a6f3445e3c8465e48d91f0d3a1d806759 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Tue, 28 Dec 2021 15:34:31 -0500
Subject: [PATCH 12/15] Use > 0.0 instead of boolean when testing maxfps
---
src/zm_monitorstream.cpp | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp
index d4d387219..35cd1beb2 100644
--- a/src/zm_monitorstream.cpp
+++ b/src/zm_monitorstream.cpp
@@ -371,13 +371,15 @@ bool MonitorStream::sendFrame(const std::string &filepath, SystemTimePoint times
fputs("\r\n", stdout);
fflush(stdout);
- TimePoint send_end_time = std::chrono::steady_clock::now();
- TimePoint::duration frame_send_time = send_end_time - send_start_time;
+ if (maxfps > 0.0) {
+ TimePoint send_end_time = std::chrono::steady_clock::now();
+ TimePoint::duration frame_send_time = send_end_time - send_start_time;
- if (frame_send_time > Milliseconds(lround(Milliseconds::period::den / maxfps))) {
- Info("Frame send time %" PRIi64 " ms too slow, throttling maxfps to %.2f",
- static_cast(std::chrono::duration_cast(frame_send_time).count()),
- maxfps);
+ if (frame_send_time > Milliseconds(lround(Milliseconds::period::den / maxfps))) {
+ Info("Frame send time %" PRIi64 " ms too slow, throttling maxfps to %.2f",
+ static_cast(std::chrono::duration_cast(frame_send_time).count()),
+ maxfps);
+ }
}
last_frame_sent = now;
@@ -461,7 +463,7 @@ bool MonitorStream::sendFrame(Image *image, SystemTimePoint timestamp) {
} // Not mpeg
last_frame_sent = std::chrono::steady_clock::now();
- if (maxfps) {
+ if (maxfps > 0.0) {
TimePoint::duration frame_send_time = last_frame_sent - send_start_time;
TimePoint::duration maxfps_milliseconds = Milliseconds(lround(Milliseconds::period::den / maxfps));
@@ -803,7 +805,7 @@ void MonitorStream::runStream() {
// sent a frame, so update
double capture_fps = monitor->GetFPS();
- double fps = (maxfps && (capture_fps > maxfps)) ? maxfps : capture_fps;
+ double fps = ((maxfps > 0.0) && (capture_fps > maxfps)) ? maxfps : capture_fps;
double sleep_time_seconds = (1 / ((fps ? fps : 1))) // 1 second / fps
* (replay_rate ? abs(replay_rate)/ZM_RATE_BASE : 1); // replay_rate is 100 for 1x
Debug(3, "Using %f for maxfps. capture_fps: %f maxfps %f * replay_rate: %d = %f", fps, capture_fps, maxfps, replay_rate, sleep_time_seconds);
From 698fe14453430378cce79b012a44cfe58f9de4da Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Sun, 26 Dec 2021 15:19:13 -0500
Subject: [PATCH 13/15] set zm_terminate instead of exit() so that all the
cleanup code happens
---
src/zm_eventstream.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp
index 0c104ffd0..7ef3619c2 100644
--- a/src/zm_eventstream.cpp
+++ b/src/zm_eventstream.cpp
@@ -837,12 +837,13 @@ void EventStream::runStream() {
//checkInitialised();
- if ( type == STREAM_JPEG )
+ if (type == STREAM_JPEG)
fputs("Content-Type: multipart/x-mixed-replace;boundary=" BOUNDARY "\r\n\r\n", stdout);
- if ( !event_data ) {
+ if (!event_data) {
sendTextFrame("No event data found");
- exit(0);
+ zm_terminate = true;
+ return;
}
double fps = 1.0;
From e73765c5bf1c5273e23ef776fb839dfd75c2aa4f Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Sat, 1 Jan 2022 17:55:28 -0500
Subject: [PATCH 14/15] add basic readthedocs config
---
.readthedocs.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 .readthedocs.yaml
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 000000000..38593578d
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,9 @@
+version: 2
+
+build:
+ os: "ubuntu-20.04"
+ tools:
+ python: "3.8"
+
+sphinx:
+ fail_on_warning: true
From a76128e9c468bcb979cdd74cbd5c1d737319db36 Mon Sep 17 00:00:00 2001
From: Isaac Connor
Date: Sat, 1 Jan 2022 18:56:13 -0500
Subject: [PATCH 15/15] include monitor->Importance when logging failed camera
connects
---
src/zm_ffmpeg_camera.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp
index 728b51783..2b36c34f6 100644
--- a/src/zm_ffmpeg_camera.cpp
+++ b/src/zm_ffmpeg_camera.cpp
@@ -295,7 +295,8 @@ int FfmpegCamera::OpenFfmpeg() {
ret = avformat_open_input(&mFormatContext, mPath.c_str(), nullptr, &opts);
if ( ret != 0 )
{
- Error("Unable to open input %s due to: %s", mPath.c_str(),
+ logPrintf(Logger::ERROR + monitor->Importance(),
+ "Unable to open input %s due to: %s", mPath.c_str(),
av_make_error_string(ret).c_str());
if ( mFormatContext ) {