From 2c1a02ade6a58478736d89d4c46ebab15a7d91c6 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 18 Feb 2015 16:34:35 -0500 Subject: [PATCH 1/5] Add was_alarmed property and WasAlarmed method to Zone --- src/zm_zone.cpp | 1 + src/zm_zone.h | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zm_zone.cpp b/src/zm_zone.cpp index 90c954d9e..e817f0908 100644 --- a/src/zm_zone.cpp +++ b/src/zm_zone.cpp @@ -51,6 +51,7 @@ void Zone::Setup( Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_ Debug( 1, "Initialised zone %d/%s - %d - %dx%d - Rgb:%06x, CM:%d, MnAT:%d, MxAT:%d, MnAP:%d, MxAP:%d, FB:%dx%d, MnFP:%d, MxFP:%d, MnBS:%d, MxBS:%d, MnB:%d, MxB:%d, OF: %d, AF: %d", id, label, type, polygon.Width(), polygon.Height(), alarm_rgb, check_method, min_pixel_threshold, max_pixel_threshold, min_alarm_pixels, max_alarm_pixels, filter_box.X(), filter_box.Y(), min_filter_pixels, max_filter_pixels, min_blob_pixels, max_blob_pixels, min_blobs, max_blobs, overload_frames, extend_alarm_frames ); alarmed = false; + was_alarmed = false; pixel_diff = 0; alarm_pixels = 0; alarm_filter_pixels = 0; diff --git a/src/zm_zone.h b/src/zm_zone.h index c431f88a0..266ffc753 100644 --- a/src/zm_zone.h +++ b/src/zm_zone.h @@ -126,14 +126,16 @@ public: inline const Image *AlarmImage() const { return( image ); } inline const Polygon &GetPolygon() const { return( polygon ); } inline bool Alarmed() const { return( alarmed ); } - inline void SetAlarm() { alarmed = true; } - inline void ClearAlarm() { alarmed = false; } + inline bool WasAlarmed() const { return( was_alarmed ); } + inline void SetAlarm() { was_alarmed = alarmed; alarmed = true; } + inline void ClearAlarm() { was_alarmed = alarmed; alarmed = false; } inline Coord GetAlarmCentre() const { return( alarm_centre ); } inline unsigned int Score() const { return( score ); } inline void ResetStats() { alarmed = false; + was_alarmed = false; pixel_diff = 0; alarm_pixels = 0; alarm_filter_pixels = 0; From bedc1d3e132be17e869b0ed7f2166b6f4a8c77e7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 5 Jun 2017 16:29:04 -0400 Subject: [PATCH 2/5] fix spacing --- web/skins/classic/views/monitor.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index 84710a404..6b3c692c5 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -36,15 +36,15 @@ if ( ZM_OPT_X10 ) $tabs["x10"] = translate('X10'); $tabs["misc"] = translate('Misc'); - if ( isset($_REQUEST['tab']) ) +if ( isset($_REQUEST['tab']) ) $tab = validHtmlStr($_REQUEST['tab']); - else +else $tab = "general"; - $Server = null; - if ( defined( 'ZM_SERVER_ID' ) ) { - $Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) ); - } +$Server = null; +if ( defined( 'ZM_SERVER_ID' ) ) { + $Server = dbFetchOne( 'SELECT * FROM Servers WHERE Id=?', NULL, array( ZM_SERVER_ID ) ); +} if ( ! $Server ) { $Server = array( 'Id' => '' ); } From f67584ebf9f5b63008e08017eabf6c8db37bfb51 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Thu, 8 Jun 2017 08:39:49 -0400 Subject: [PATCH 3/5] remove references to incomplete icon work --- distros/ubuntu1604/zoneminder.install | 1 - distros/ubuntu1604/zoneminder.menu | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 distros/ubuntu1604/zoneminder.menu diff --git a/distros/ubuntu1604/zoneminder.install b/distros/ubuntu1604/zoneminder.install index b0b1ad5b6..8a26777c0 100644 --- a/distros/ubuntu1604/zoneminder.install +++ b/distros/ubuntu1604/zoneminder.install @@ -3,7 +3,6 @@ usr/bin usr/lib/zoneminder usr/share/polkit-1 usr/share/zoneminder/db -usr/share/zoneminder/icons usr/share/zoneminder/www # libzoneminder-perl files: diff --git a/distros/ubuntu1604/zoneminder.menu b/distros/ubuntu1604/zoneminder.menu deleted file mode 100644 index fa3f3ff36..000000000 --- a/distros/ubuntu1604/zoneminder.menu +++ /dev/null @@ -1,2 +0,0 @@ -?package(zoneminder):needs="x11" section="Applications/Video" title="ZoneMinder" command="/usr/bin/x-www-browser http://localhost/zm" icon="/usr/share/zoneminder/icons/16x16/icon.xpm" - From b16d84911bb5b9d740af3b6a39b63b8bcd83faa4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 9 Jun 2017 10:38:20 -0400 Subject: [PATCH 4/5] merge fixes from storageareas --- utils/do_debian_package.sh | 89 +++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 554dd9c38..a825d0b62 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -63,6 +63,8 @@ DATE=`date -R` if [ "$TYPE" == "" ]; then echo "Defaulting to source build" TYPE="source"; +else + echo "Doing $TYPE build" fi; if [ "$DISTRO" == "" ]; then @@ -81,6 +83,8 @@ if [ "$RELEASE" != "" ]; then if [ "$GITHUB_FORK" != "" ] && [ "$GITHUB_FORK" != "ZoneMinder" ]; then echo "Releases cannot have a fork ($GITHUB_FORK).... exiting." exit 0; + else + GITHUB_FORK="ZoneMinder"; fi BRANCH="release-$RELEASE" else @@ -118,10 +122,10 @@ if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then git pull cd ../ echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" - git clone "${GITHUB_FORK}_ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" + git clone "${GITHUB_FORK}_ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" else echo "git clone https://github.com/$GITHUB_FORK/ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" - git clone "https://github.com/$GITHUB_FORK/ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" + git clone "https://github.com/$GITHUB_FORK/ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" fi else echo "release dir already exists. Please remove it." @@ -129,17 +133,13 @@ else fi; cd "${GITHUB_FORK}_zoneminder_release" -if [ $RELEASE ]; then - git checkout $RELEASE -else git checkout $BRANCH -fi; cd ../ VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` if [ $VERSION == "" ]; then - exit 1; + exit 1; fi; if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then VERSION="$VERSION~$SNAPSHOT"; @@ -148,12 +148,17 @@ fi; DIRECTORY="zoneminder_$VERSION"; echo "Doing $TYPE release $DIRECTORY"; mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; +if [ $? -ne 0 ]; then + echo "Error status code is: $?" + echo "Setting up build dir failed."; + exit $?; +fi; cd "$DIRECTORY.orig"; git submodule init git submodule update --init --recursive if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then - mv distros/ubuntu1204 debian + mv distros/ubuntu1204 debian else if [ "$DISTRO" == "wheezy" ]; then mv distros/debian debian @@ -185,6 +190,13 @@ zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY -- $AUTHOR $DATE EOF +cat < debian/NEWS +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY + + * Release $VERSION + + -- $AUTHOR $DATE +EOF else cat < debian/changelog zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY @@ -192,7 +204,13 @@ zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY * -- $AUTHOR $DATE +EOF +cat < debian/changelog +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY + * + + -- $AUTHOR $DATE EOF fi; @@ -207,7 +225,7 @@ if [ $TYPE == "binary" ]; then sudo apt-get install devscripts equivs sudo mk-build-deps -ir ./debian/control echo "Status: $?" - DEBUILD=debuild + DEBUILD=debuild else if [ $TYPE == "local" ]; then # Auto-install all ZoneMinder's depedencies using the Debian control file @@ -216,6 +234,7 @@ else echo "Status: $?" DEBUILD="debuild -i -us -uc -b" else + # Source build, don't need build depends. DEBUILD="debuild -S -sa" fi; fi; @@ -232,48 +251,56 @@ fi; cd ../ if [ "$INTERACTIVE" != "no" ]; then read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" - [[ $REPLY == [yY] ]] && { mv $DIRECTORY zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; } + [[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; } echo "Done!" else - rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; + rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; fi if [ $TYPE == "binary" ]; then if [ "$INTERACTIVE" != "no" ]; then - echo "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" - read install - if [ "$install" == "Y" ]; then + read -p "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" + if [[ $REPLY == [yY] ]]; then sudo dpkg -i $DIRECTORY*.deb + else + echo $REPLY; fi; if [ "$DISTRO" == "jessie" ]; then - echo "Do you want to upload this binary to zmrepo? (y/N)" - read install - if [ "$install" == "Y" ]; then - scp "zoneminder_*-${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/" + read -p "Do you want to upload this binary to zmrepo? (y/N)" + if [[ $REPLY == [yY] ]]; then + if [ "$RELEASE" != "" ]; then + scp "zoneminder_${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/stable/mini-dinstall/incoming/" + else + if [ "$BRANCH" == "" ]; then + scp "zoneminder_${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/master/mini-dinstall/incoming/" + else + scp "$DIRECTORY-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/" + fi; fi; + fi; fi; fi; else SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes"; - PPA=""; - if [ "$RELEASE" != "" ]; then - PPA="ppa:iconnor/zoneminder"; - else - if [ "$BRANCH" == "" ]; then - PPA="ppa:iconnor/zoneminder-master"; - else - PPA="ppa:iconnor/zoneminder-$BRANCH"; - fi; - fi; + PPA=""; + if [ "$RELEASE" != "" ]; then + PPA="ppa:iconnor/zoneminder"; + else + if [ "$BRANCH" == "" ]; then + PPA="ppa:iconnor/zoneminder-master"; + else + PPA="ppa:iconnor/zoneminder-$BRANCH"; + fi; + fi; dput="Y"; if [ "$INTERACTIVE" != "no" ]; then echo "Ready to dput $SC to $PPA ? Y/N..."; read dput fi - if [ "$dput" == "Y" -o "$dput" == "y" ]; then - dput $PPA $SC - fi; + if [ "$dput" == [Yy] ]; then + dput $PPA $SC + fi; fi; From 162cc05a33f68ff8e8a7ab46f31e8623bcf0bd45 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 9 Jun 2017 11:05:44 -0400 Subject: [PATCH 5/5] when debug is turned on, fflush after every line. Debug logging is almost useless when debugging a crash without this. --- src/zm_logger.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/zm_logger.cpp b/src/zm_logger.cpp index 78d9ab934..f122fa1d8 100644 --- a/src/zm_logger.cpp +++ b/src/zm_logger.cpp @@ -194,7 +194,12 @@ void Logger::initialise( const std::string &id, const Options &options ) { level( tempLevel ); - mFlush = (envPtr = getenv( "LOG_FLUSH")) ? atoi( envPtr ) : false; + mFlush = false; + if (envPtr = getenv( "LOG_FLUSH")) { + mFlush = atoi( envPtr ); + } else if ( config.log_debug ) { + mFlush = true; + } //mRuntime = (envPtr = getenv( "LOG_RUNTIME")) ? atoi( envPtr ) : false; {