From 97164fd4d706c13be75d58c682d3cff89f51fffd Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 31 Oct 2021 14:44:36 -0400 Subject: [PATCH 1/6] Fix use of thisUrl instead of monitorUrl when getting stream status. Fix changing stream image due to use of jquery. --- web/skins/classic/views/js/event.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 050a78d59..c449447f4 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -34,7 +34,7 @@ function streamReq(data) { data.view = 'request'; data.request = 'stream'; - $j.getJSON(thisUrl, data) + $j.getJSON(monitorUrl, data) .done(getCmdResponse) .fail(logAjaxFail); } @@ -300,7 +300,7 @@ function getCmdResponse(respObj, respText) { if (streamStatus.auth) { // Try to reload the image stream. - var streamImg = $j('#evtStream'); + var streamImg = document.getElementById('evtStream'); if (streamImg) { streamImg.src = streamImg.src.replace(/auth=\w+/i, 'auth='+streamStatus.auth); } From 0e3f694097be6674c81d4e4b5b03c5c0ae092f0f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 31 Oct 2021 15:19:26 -0400 Subject: [PATCH 2/6] Rename bootstrap with version so we don't have to cache bust it, so that .map loading works. --- web/skins/classic/includes/functions.php | 2 +- web/skins/classic/js/{bootstrap.js => bootstrap-4.5.0.js} | 0 .../classic/js/{bootstrap.min.js => bootstrap-4.5.0.min.js} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename web/skins/classic/js/{bootstrap.js => bootstrap-4.5.0.js} (100%) rename web/skins/classic/js/{bootstrap.min.js => bootstrap-4.5.0.min.js} (100%) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 1b01a73e8..c593601aa 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -916,7 +916,7 @@ function xhtmlFooter() { ?> - + Date: Tue, 2 Nov 2021 17:10:02 -0400 Subject: [PATCH 3/6] av_write_trailer can return a positive value which is not an error --- src/zm_videostore.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 2b9f662e6..ad401b22c 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -619,7 +619,8 @@ VideoStore::~VideoStore() { Debug(1, "Writing trailer"); /* Write the trailer before close */ - if (int rc = av_write_trailer(oc)) { + int rc; + if ((rc = av_write_trailer(oc)) < 0) { Error("Error writing trailer %s", av_err2str(rc)); } else { Debug(3, "Success Writing trailer"); @@ -629,7 +630,7 @@ VideoStore::~VideoStore() { if (!(out_format->flags & AVFMT_NOFILE)) { /* Close the out file. */ Debug(4, "Closing"); - if (int rc = avio_close(oc->pb)) { + if ((rc = avio_close(oc->pb)) < 0) { Error("Error closing avio %s", av_err2str(rc)); } } else { From 61f7989bec1b947960da5e29d2b63de37cbdfeb9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 31 Oct 2021 22:16:15 -0400 Subject: [PATCH 4/6] Actually report the # of dbQueue entries --- src/zm_db.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_db.cpp b/src/zm_db.cpp index f659bb361..e3b737c07 100644 --- a/src/zm_db.cpp +++ b/src/zm_db.cpp @@ -255,7 +255,7 @@ void zmDbQueue::process() { Logger *log = Logger::fetch(); Logger::Level db_level = log->databaseLevel(); log->databaseLevel(Logger::NOLOG); - Warning("db queue size has grown larger than 10 entries"); + Warning("db queue size has grown larger %zu than 10 entries", mQueue.size()); log->databaseLevel(db_level); } std::string sql = mQueue.front(); From 86199718648f5cb929be2cb82c50772e0a28c7ef Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 2 Nov 2021 10:12:25 -0400 Subject: [PATCH 5/6] Better debug messages --- src/zm_event.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zm_event.cpp b/src/zm_event.cpp index adda18655..14b0fc9a3 100644 --- a/src/zm_event.cpp +++ b/src/zm_event.cpp @@ -479,7 +479,7 @@ void Event::AddFrame(Image *image, Debug(1, "Writing snapshot"); WriteFrameImage(image, timestamp, snapshot_file.c_str()); } else { - Debug(1, "Not Writing snapshot"); + Debug(1, "Not Writing snapshot because score %d > max %d", score, max_score); } // We are writing an Alarm frame @@ -491,7 +491,7 @@ void Event::AddFrame(Image *image, Debug(1, "Writing alarm image"); WriteFrameImage(image, timestamp, alarm_file.c_str()); } else { - Debug(1, "Not Writing alarm image"); + Debug(3, "Not Writing alarm image because alarm frame already written"); } if (alarm_image and (save_jpegs & 2)) { From 3208059040aee7c78152952033a660085cf6d75f Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 2 Nov 2021 17:23:23 -0400 Subject: [PATCH 6/6] Fix event listing when not paginated. --- web/ajax/events.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/ajax/events.php b/web/ajax/events.php index 6d87da869..4e364242a 100644 --- a/web/ajax/events.php +++ b/web/ajax/events.php @@ -239,15 +239,17 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim } # end if search $sql = 'SELECT ' .$col_str. ' FROM `Events` AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id WHERE '.$search_filter->sql().' ORDER BY ' .$sort. ' ' .$order; - ZM\Debug('Calling the following sql query: ' .$sql); $filtered_rows = dbFetchAll($sql); - ZM\Debug('Have ' . count($filtered_rows) . ' events matching search filter.'); + ZM\Debug('Have ' . count($filtered_rows) . ' events matching search filter: '.$sql); } else { $filtered_rows = $unfiltered_rows; } # end if search_filter->terms() > 1 + if ($limit) + $filtered_rows = array_slice($filtered_rows, $offset, $limit); + $returned_rows = array(); - foreach ( array_slice($filtered_rows, $offset, $limit) as $row ) { + foreach ($filtered_rows as $row) { $event = new ZM\Event($row); $scale = intval(5*100*ZM_WEB_LIST_THUMB_WIDTH / $event->Width());