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 diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index d20e006d4..09833294f 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; 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; 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 ) { diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 607f41216..c30b511e0 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1901,16 +1901,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+std::string(":")+alarm_cause; noteSetMap[MOTION_CAUSE] = zoneSet; } // end if motion_score } diff --git a/src/zm_monitorstream.cpp b/src/zm_monitorstream.cpp index fddd38ccb..90b37e5d6 100644 --- a/src/zm_monitorstream.cpp +++ b/src/zm_monitorstream.cpp @@ -367,13 +367,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; @@ -456,7 +458,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)); @@ -810,7 +812,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); diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 00dcd44e9..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" @@ -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 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(); }); 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 = ""; diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 1ddea7143..277de329b 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -1327,9 +1327,9 @@ echo htmlSelect('newMonitor[ReturnLocation]', $return_options, $monitor->ReturnL translate('Not important'), + 'Normal'=>translate('Normal'), 'Less'=>translate('Less important'), - 'Normal'=>translate('Normal') + 'Not'=>translate('Not important') ), $monitor->Importance()); ?> 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()); +?> +