From db41693fd6d46b13eefcca00c6df0b2bcfc2f01a Mon Sep 17 00:00:00 2001 From: Scott Robinson Date: Sun, 22 Dec 2013 20:53:09 +0000 Subject: [PATCH 01/29] Update montage.js save montage scale % as cookie --- web/skins/classic/views/js/montage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index cc49d5776..b8ea83aa6 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -134,6 +134,7 @@ function changeScale() streamImg.style.width = newWidth + "px"; streamImg.style.height = newHeight + "px"; } + Cookie.write( 'zmMontageScale', scale, { duration: 10*365 } ); } var monitors = new Array(); From 375d67cdf2137c89f9f82e64fa6831aa12831f9a Mon Sep 17 00:00:00 2001 From: Scott Robinson Date: Sun, 22 Dec 2013 20:56:18 +0000 Subject: [PATCH 02/29] Update montage.php Make use of new zmMontageScale cookie --- web/skins/classic/views/montage.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/skins/classic/views/montage.php b/web/skins/classic/views/montage.php index 6a93ee727..2362a7fad 100644 --- a/web/skins/classic/views/montage.php +++ b/web/skins/classic/views/montage.php @@ -44,8 +44,11 @@ foreach( dbFetchAll( $sql ) as $row ) { continue; } + if ( isset( $_REQUEST['scale'] ) ) $scale = validInt($_REQUEST['scale']); + else if ( isset( $_COOKIE['zmMontageScale'] ) ) + $scale = $_COOKIE['zmMontageScale']; else $scale = reScale( SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE ); From c4d22672ac4fae5ca2c92495567616a7dd1f411d Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 23 Dec 2013 17:06:31 -0600 Subject: [PATCH 03/29] Specfile changes related to zmfix --- distros/fedora/zoneminder.cmake.f19.spec | 7 +++++-- distros/fedora/zoneminder.f19.spec | 7 +++++-- distros/redhat/zoneminder.cmake.el6.spec | 7 +++++-- distros/redhat/zoneminder.el6.spec | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index 2b8a6756f..2602ffb5b 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -78,8 +78,9 @@ if [ $1 -eq 1 ] ; then /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi -# Allow zoneminder access to local video sources -/usr/bin/gpasswd -a %zmuid_final video +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Display the README for post installation instructions /usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora @@ -126,6 +127,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl diff --git a/distros/fedora/zoneminder.f19.spec b/distros/fedora/zoneminder.f19.spec index 1f0eac54b..eafe27425 100644 --- a/distros/fedora/zoneminder.f19.spec +++ b/distros/fedora/zoneminder.f19.spec @@ -180,8 +180,9 @@ if [ $1 -eq 1 ] ; then /bin/systemctl daemon-reload >/dev/null 2>&1 || : fi -# Allow zoneminder access to local video sources -/usr/bin/gpasswd -a %zmuid_final video +# Allow zoneminder access to local video sources, serial ports, and x10 +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Display the README for post installation instructions /usr/bin/less %{_docdir}/%{name}-%{version}/README.Fedora @@ -228,6 +229,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl diff --git a/distros/redhat/zoneminder.cmake.el6.spec b/distros/redhat/zoneminder.cmake.el6.spec index d732c6af5..6c26c6598 100644 --- a/distros/redhat/zoneminder.cmake.el6.spec +++ b/distros/redhat/zoneminder.cmake.el6.spec @@ -78,9 +78,10 @@ make install /sbin/chkconfig --add zoneminder /sbin/chkconfig zoneminder on -# Allow zoneminder access to local video sources +# Allow zoneminder access to local video sources, serial ports, and x10 echo -/usr/bin/gpasswd -a apache video +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Create and load zoneminder selinux policy module echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n" @@ -124,6 +125,8 @@ rm -rf %{_docdir}/%{name}-%{version} %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl diff --git a/distros/redhat/zoneminder.el6.spec b/distros/redhat/zoneminder.el6.spec index d47d66f65..63419b4d3 100644 --- a/distros/redhat/zoneminder.el6.spec +++ b/distros/redhat/zoneminder.el6.spec @@ -190,9 +190,10 @@ popd /sbin/chkconfig --add zoneminder /sbin/chkconfig zoneminder on -# Allow zoneminder access to local video sources +# Allow zoneminder access to local video sources, serial ports, and x10 echo -/usr/bin/gpasswd -a apache video +/usr/bin/gpasswd -a %{zmuid_final} video +/usr/bin/gpasswd -a %{zmuid_final} dialout # Create and load zoneminder selinux policy module echo -e "\nCreating and installing a ZoneMinder SELinux policy module. Please wait.\n" @@ -233,6 +234,8 @@ fi %{_bindir}/zmdc.pl %{_bindir}/zmf %{_bindir}/zmfilter.pl +# zmfix removed from zoneminder 1.26.6 +#%attr(4755,root,root) %{_bindir}/zmfix %{_bindir}/zmpkg.pl %{_bindir}/zmstreamer %{_bindir}/zmtrack.pl From dbd2ee348e189e3c63731a9dfa4f7c1eca074571 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Mon, 23 Dec 2013 19:41:00 -0600 Subject: [PATCH 04/29] define variables to toggle x10 & ffmpeg support --- distros/fedora/zoneminder.cmake.f19.spec | 25 ++++++++++-------- distros/fedora/zoneminder.f19.spec | 32 +++++++++++------------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index 2602ffb5b..b54805adf 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -3,6 +3,10 @@ %define zmuid_final apache %define zmgid_final apache +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + Name: zoneminder Version: 1.26.5 Release: 1%{?dist} @@ -17,8 +21,6 @@ URL: http://www.zoneminder.com/ Source: ZoneMinder-%{version}.tar.gz Patch1: zoneminder-1.26.0-defaults.patch -# Enable this patch to disable ffmpeg support -#Patch2: zoneminder-1.26.3-noffmpeg.patch BuildRequires: cmake gnutls-devel systemd-units bzip2-devel BuildRequires: community-mysql-devel pcre-devel libjpeg-turbo-devel @@ -30,17 +32,16 @@ BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) BuildRequires: perl(Expect) BuildRequires: gcc gcc-c++ -# Comment out for no ffmpeg -BuildRequires: ffmpeg-devel -# Uncomment for X10 support -#BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime) +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} Requires: httpd php php-mysql cambozola -Requires: libjpeg-turbo ffmpeg +Requires: libjpeg-turbo Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) Requires: perl(DBD::mysql) perl(Archive::Tar) perl(Archive::Zip) Requires: perl(MIME::Entity) perl(MIME::Lite) perl(Net::SMTP) perl(Net::FTP) Requires: perl(LWP::Protocol::https) +%{!?_without_ffmpeg:Requires: ffmpeg} Requires(post): systemd-units systemd-sysv Requires(post): /usr/bin/gpasswd @@ -64,7 +65,12 @@ too much degradation of performance. #%patch2 -p0 -b .noffmpeg %build -%cmake -DZM_TARGET_DISTRO="f19" -DZM_NO_X10=ON -DZM_NO_FFMPEG=ON -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` . +%cmake \ + -DZM_TARGET_DISTRO="f19" \ + -DZM_PERL_SUBPREFIX=`x="%{perl_vendorlib}" ; echo ${x#"%{_prefix}"}` \ +%{?_without_ffmpeg:-DZM_NO_FFMPEG=ON} \ +%{?_without_x10:-DZM_NO_X10=ON} \ + . make %{?_smp_mflags} @@ -137,8 +143,7 @@ fi %{_bindir}/zmupdate.pl %{_bindir}/zmvideo.pl %{_bindir}/zmwatch.pl -# Uncomment this for x10 support -#%{_bindir}/zmx10.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} %{perl_vendorlib}/ZoneMinder* %{perl_vendorlib}/%{_arch}-linux-thread-multi/auto/ZoneMinder* diff --git a/distros/fedora/zoneminder.f19.spec b/distros/fedora/zoneminder.f19.spec index eafe27425..b0733eb43 100644 --- a/distros/fedora/zoneminder.f19.spec +++ b/distros/fedora/zoneminder.f19.spec @@ -7,6 +7,10 @@ %define zmuid_final apache %define zmgid_final apache +### Delete the lines below to build with ffmpeg and/or x10 +%define _without_ffmpeg 1 +%define _without_x10 1 + Name: zoneminder Version: 1.26.5 Release: 1%{?dist} @@ -28,11 +32,9 @@ Source2: jscalendar-%{jscrev}.zip # here. #Source3: http://mootools.net/download/get/mootools-core-%{moorev}-full-compat-yc.js -#Patch1: zoneminder-1.26.4-dbinstall.patch -Patch2: zoneminder-1.24.3-runlevel.patch -Patch3: zoneminder-1.26.0-defaults.patch -# Enable this patch to disable ffmpeg support -#Patch4: zoneminder-1.26.3-noffmpeg.patch +Patch1: zoneminder-1.24.3-runlevel.patch +Patch2: zoneminder-1.26.0-defaults.patch +%{?_without_ffmpeg:Patch3: zoneminder-1.26.3-noffmpeg.patch} BuildRequires: automake gnutls-devel systemd-units BuildRequires: libtool bzip2-devel @@ -46,10 +48,8 @@ BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) BuildRequires: perl(Expect) perl(Sys::Syslog) BuildRequires: gcc gcc-c++ BuildRequires: autoconf autoconf-archive -# Comment out for no ffmpeg -BuildRequires: ffmpeg-devel -# Uncomment for X10 support -#BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime) +%{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} +%{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} Requires: httpd php php-mysql cambozola Requires: libjpeg-turbo ffmpeg @@ -84,10 +84,9 @@ mv *html *php doc/* README ../jscalendar-doc rmdir doc popd -#%patch1 -p0 -b .dbinstall -%patch2 -p0 -b .runlevel -%patch3 -p0 -b .defaults -#%patch4 -p0 -b .noffmpeg +%patch1 -p0 -b .runlevel +%patch2 -p0 -b .defaults +%{?_without_ffmpeg:%patch3 -p0 -b .noffmpeg} chmod -x src/zm_event.cpp src/zm_user.h @@ -132,8 +131,7 @@ install -d %{buildroot}/%{_localstatedir}/run make install DESTDIR=%{buildroot} \ INSTALLDIRS=vendor rm -rf %{buildroot}/%{perl_vendorarch} %{buildroot}/%{perl_archlib} -# Comment out for x10 support -rm -f %{buildroot}/%{_bindir}/zmx10.pl +%{?_without_x10:%{__rm} -f %{buildroot}/%{_bindir}/zmx10.pl} install -m 755 -d %{buildroot}/var/log/zoneminder for dir in events images temp @@ -159,7 +157,7 @@ cp -rp jscalendar-1.0/* %{buildroot}/%{_datadir}/zoneminder/www/jscalendar # Set up cambozola pushd %{buildroot}/%{_datadir}/zoneminder/www -ln -s ../../java/cambozola.jar +%{__ln_s} ../../java/cambozola.jar popd # Set up mootools @@ -239,7 +237,7 @@ fi %{_bindir}/zmupdate.pl %{_bindir}/zmvideo.pl %{_bindir}/zmwatch.pl -#%{_bindir}/zmx10.pl +%{!?_without_x10:%{_bindir}/zmx10.pl} %{perl_vendorlib}/ZoneMinder* %{_mandir}/man*/* From f2d9deaed6babaa125398ba475635a7196badeca Mon Sep 17 00:00:00 2001 From: Scott Robinson Date: Tue, 24 Dec 2013 11:07:27 +0000 Subject: [PATCH 05/29] Update test.monitor.sql testing travis build --- db/test.monitor.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/test.monitor.sql b/db/test.monitor.sql index 084a6ebcb..030577f33 100644 --- a/db/test.monitor.sql +++ b/db/test.monitor.sql @@ -1 +1,2 @@ -INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); +INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test1','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); +INSERT INTO Monitors (Name, Type, Function, Enabled, Format, Protocol, Method, Host, Port, Path, Width, Height, Colours, Palette, Orientation, Deinterlacing, Brightness, Contrast, Hue, Colour, RefBlendPerc) VALUES ('travis_test2','Remote','Modect',1,255,'http','simple','50.79.143.149','21146','/mjpg/video.mjpg',1280,800,3,0,'0',0,-1,-1,-1,-1,12); From 3fb76eaf350d77a027682712aa727ec187c5e4a8 Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Sun, 29 Dec 2013 22:24:35 +0100 Subject: [PATCH 06/29] Initial version of control file for Foscam IP cameras. Taken from http://www.zoneminder.com/wiki/index.php/Foscam --- db/zm_create.sql.in | 5 +- scripts/Makefile.am | 1 + scripts/ZoneMinder/Makefile.PL | 1 + .../lib/ZoneMinder/Control/FI8908W.pm | 228 ++++++++++++++++++ 4 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index b6e0b8223..cb0420a13 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -542,8 +542,9 @@ insert into Controls values (8,'Pelco-D','Ffmpeg','PelcoD',1,1,0,1,1,0,0,1,NULL, insert into Controls values (9,'Pelco-P','Ffmpeg','PelcoP',1,1,0,1,1,0,0,1,NULL,NULL,NULL,NULL,1,0,3,1,1,0,0,1,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,1,0,1,0,NULL,NULL,NULL,NULL,0,NULL,NULL,1,20,1,1,1,1,0,0,0,1,1,NULL,NULL,NULL,NULL,1,0,63,1,254,1,NULL,NULL,NULL,NULL,1,0,63,1,254,0,0); INSERT INTO Controls VALUES (10,'Foscam FI8620','Ffmpeg','FI8620_Y2k',0,0,0,1,0,0,0,1,1,10,1,10,1,1,63,1,1,0,0,1,1,63,1,63,1,1,63,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,1,360,1,360,1,1,63,0,0,1,1,90,1,90,1,1,63,0,0,0,0); INSERT INTO Controls VALUES (11,'Foscam FI8608W','Ffmpeg','FI8608W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,255,1,8,0,1,1,1,0,0,0,1,1,0,0,0,0,1,1,128,0,0,1,0,0,0,0,1,1,128,0,0,0,0); -INSERT INTO Controls VALUES (12,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0); -INSERT INTO Controls VALUES (13,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO Controls VALUES (12,'Foscam FI8908W','Remote','FI8908W',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); +INSERT INTO Controls VALUES (13,'Foscam FI9821W','Ffmpeg','FI9821W_Y2k',1,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,1,0,100,1,1,0,0,1,0,100,0,100,1,0,100,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,0,100,0,100,1,0,100,1,16,0,1,1,1,0,0,0,1,1,0,360,0,360,1,0,4,0,0,1,0,90,0,90,1,0,4,0,0,0,0); +INSERT INTO Controls VALUES (14,'Loftek Sentinel','Remote','LoftekSentinel',0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,255,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,6,1,1,0,0,0,1,10,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0); -- -- Add some monitor preset values diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c56dd3de7..613278498 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -62,6 +62,7 @@ EXTRA_DIST = \ ZoneMinder/lib/ZoneMinder/Control/SkyIPCam7xx.pm \ ZoneMinder/lib/ZoneMinder/Control/FI8608W_Y2k.pm \ ZoneMinder/lib/ZoneMinder/Control/FI8620_Y2k.pm \ + ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm \ ZoneMinder/lib/ZoneMinder/Control/FI9821W_Y2k.pm \ ZoneMinder/lib/ZoneMinder/Control/LoftekSentinel.pm \ ZoneMinder/lib/ZoneMinder/Trigger/Channel.pm \ diff --git a/scripts/ZoneMinder/Makefile.PL b/scripts/ZoneMinder/Makefile.PL index a1bf572e2..ad9d9e12e 100644 --- a/scripts/ZoneMinder/Makefile.PL +++ b/scripts/ZoneMinder/Makefile.PL @@ -28,6 +28,7 @@ WriteMakefile( 'lib/ZoneMinder/Control/SkyIPCam7xx.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/SkyIPCam7xx.pm', 'lib/ZoneMinder/Control/FI8608W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8608W_Y2k.pm', 'lib/ZoneMinder/Control/FI8620_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8620_Y2k.pm', + 'lib/ZoneMinder/Control/FI8908W.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI8908W.pm', 'lib/ZoneMinder/Control/FI9821W_Y2k.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/FI9821W_Y2k.pm', 'lib/ZoneMinder/Control/LoftekSentinel.pm' => '$(INST_LIBDIR)/ZoneMinder/Control/LoftekSentinel.pm', 'lib/ZoneMinder/Trigger/Channel.pm' => '$(INST_LIBDIR)/ZoneMinder/Trigger/Channel.pm', diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm new file mode 100644 index 000000000..6afe64a43 --- /dev/null +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm @@ -0,0 +1,228 @@ +# ========================================================================== +# +# ZoneMinder Foscam FI8908W / FI8918W IP Control Protocol Module, $Date$, $Revision$ +# Copyright (C) 2001-2008 Philip Coombes +# Modified for use with Foscam FI8908W IP Camera by Dave Harris +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ========================================================================== +# +# This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control +# protocol +# +package ZoneMinder::Control::FI8908W; + +use 5.006; +use strict; +use warnings; + +require ZoneMinder::Base; +require ZoneMinder::Control; + +our @ISA = qw(ZoneMinder::Control); + +our $VERSION = $ZoneMinder::Base::VERSION; + +# ========================================================================== +# +# Foscam FI8908W IP Control Protocol +# +# ========================================================================== + +use ZoneMinder::Logger qw(:all); +use ZoneMinder::Config qw(:all); + +use Time::HiRes qw( usleep ); + +# To rotate camera one needs "operator" privileges: +our $user = 'operator'; +our $pass = 'secretpassword'; + +sub new +{ + my $class = shift; + my $id = shift; + my $self = ZoneMinder::Control->new( $id ); + my $logindetails = ""; + bless( $self, $class ); + srand( time() ); + return $self; +} + +our $AUTOLOAD; + +sub AUTOLOAD +{ + my $self = shift; + my $class = ref($self) || croak( "$self not object" ); + my $name = $AUTOLOAD; + $name =~ s/.*://; + if ( exists($self->{$name}) ) + { + return( $self->{$name} ); + } + Fatal( "Can't access $name member of object of class $class" ); +} + +sub open +{ + my $self = shift; + + $self->loadMonitor(); + + use LWP::UserAgent; + $self->{ua} = LWP::UserAgent->new; + $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + + $self->{state} = 'open'; +} + +sub close +{ + my $self = shift; + $self->{state} = 'closed'; +} + +sub printMsg +{ + my $self = shift; + my $msg = shift; + my $msg_len = length($msg); + + Debug( $msg."[".$msg_len."]" ); +} + +sub sendCmd +{ + my $self = shift; + my $cmd = shift; + my $result = undef; + printMsg( $cmd, "Tx" ); + + my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); + my $res = $self->{ua}->request($req); + + if ( $res->is_success ) + { + $result = !undef; + } + else + { + Error( "Error check failed:'".$res->status_line()."'" ); + } + + return( $result ); +} + +sub reset +{ + my $self = shift; + Debug( "Camera Reset" ); + my $cmd = "reboot.cgi?user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Up Arrow +sub moveConUp +{ + my $self = shift; + Debug( "Move Up" ); + my $cmd = "decoder_control.cgi?command=0&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Down Arrow +sub moveConDown +{ + my $self = shift; + Debug( "Move Down" ); + my $cmd = "decoder_control.cgi?command=2&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Left Arrow +sub moveConLeft +{ + my $self = shift; + Debug( "Move Left" ); + my $cmd = "decoder_control.cgi?command=6&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Right Arrow +sub moveConRight +{ + my $self = shift; + Debug( "Move Right" ); + my $cmd = "decoder_control.cgi?command=4&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Diagonally Up Right Arrow +sub moveConUpRight +{ + my $self = shift; + Debug( "Move Diagonally Up Right" ); + my $cmd = "decoder_control.cgi?command=90&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Diagonally Down Right Arrow +sub moveConDownRight +{ + my $self = shift; + Debug( "Move Diagonally Down Right" ); + my $cmd = "decoder_control.cgi?command=92&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Diagonally Up Left Arrow +sub moveConUpLeft +{ + my $self = shift; + Debug( "Move Diagonally Up Left" ); + my $cmd = "decoder_control.cgi?command=91&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Diagonally Down Left Arrow +sub moveConDownLeft +{ + my $self = shift; + Debug( "Move Diagonally Down Left" ); + my $cmd = "decoder_control.cgi?command=93&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +#Stop +sub moveStop +{ + my $self = shift; + Debug( "Move Stop" ); + my $cmd = "decoder_control.cgi?user=$user&pwd=$pass&command=1"; + $self->sendCmd( $cmd ); +} + +#Move Camera to Home Position +sub presetHome +{ + my $self = shift; + Debug( "Home Preset" ); + my $cmd = "decoder_control.cgi?command=25&user=$user&pwd=$pass"; + $self->sendCmd( $cmd ); +} + +1; From 7bf0bcf4ef9bc049ef6cb2231de5298c0552bcf7 Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Mon, 30 Dec 2013 15:31:50 +0100 Subject: [PATCH 07/29] Updated package version (otherwise build process stops). --- distros/debian/postinst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/debian/postinst b/distros/debian/postinst index 716c475e6..32e8d7a96 100644 --- a/distros/debian/postinst +++ b/distros/debian/postinst @@ -2,7 +2,7 @@ set -e -VERSION=1.26.4 +VERSION=1.26.5 if [ "$1" = "configure" ]; then # From e745bbf14e8541b7e10085f0c0f08493090f8620 Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Mon, 30 Dec 2013 15:32:06 +0100 Subject: [PATCH 08/29] No need to redefine RUNDIR and ZM_RUNDIR, as they already depend on DESTDIR. --- distros/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/debian/rules b/distros/debian/rules index 3dea63174..3a6840e7f 100755 --- a/distros/debian/rules +++ b/distros/debian/rules @@ -43,7 +43,7 @@ override_dh_clean: override_dh_install: # Add here commands to install the package into debian/zm. - $(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder RUNDIR=$(CURDIR)/debian/zoneminder/var/run ZM_RUNDIR=$(CURDIR)/debian/zoneminder/var/run + $(MAKE) install DESTDIR=$(CURDIR)/debian/zoneminder install -D -m 0644 db/zm_create.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db install -D -m 0644 db/zm_update-*.sql $(CURDIR)/debian/zoneminder/usr/share/zoneminder/db install -D -m 0644 debian/apache.conf $(CURDIR)/debian/zoneminder/etc/zm From b370f980048ff7f5fda6d79f705a13101959fe29 Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Mon, 30 Dec 2013 15:32:20 +0100 Subject: [PATCH 09/29] Improved the script using advise from http://stackoverflow.com/a/16405301/267197 so that re-running the script does not crash reinstall. --- db/zm_update-1.26.5.sql | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/db/zm_update-1.26.5.sql b/db/zm_update-1.26.5.sql index 01308aae4..7c70d85b7 100644 --- a/db/zm_update-1.26.5.sql +++ b/db/zm_update-1.26.5.sql @@ -5,5 +5,19 @@ -- -- Add AlarmRefBlendPerc field for controlling the reference image blend percent during alarm (see pull request #241) -- -ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`; + +SET @s = (SELECT IF( + (SELECT COUNT(*) + FROM INFORMATION_SCHEMA.COLUMNS + WHERE table_name = 'Monitors' + AND table_schema = DATABASE() + AND column_name = 'AlarmRefBlendPerc' + ) > 0, +"SELECT 1", +"ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`" +)); + +PREPARE stmt FROM @s; +EXECUTE stmt; + From e6b9b8218bf77278dfed8d0d458e4fb356c1c2e5 Mon Sep 17 00:00:00 2001 From: "Adam J. Henry" Date: Tue, 31 Dec 2013 17:32:20 -0600 Subject: [PATCH 10/29] Enclose value of the Notes attribute with quotes. --- web/skins/classic/includes/timeline_functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/web/skins/classic/includes/timeline_functions.php b/web/skins/classic/includes/timeline_functions.php index 74a58c06c..cf92f8689 100644 --- a/web/skins/classic/includes/timeline_functions.php +++ b/web/skins/classic/includes/timeline_functions.php @@ -228,6 +228,7 @@ function parseFilterToTree( $filter ) case 'MonitorName': case 'Name': case 'Cause': + case 'Notes': $value = "'$value'"; break; case 'DateTime': From 20dd76b3547636d277578d5623584d795174aedb Mon Sep 17 00:00:00 2001 From: Dmitry Katsubo Date: Mon, 30 Dec 2013 13:22:40 +0100 Subject: [PATCH 11/29] Using the full path for ZM_VERSION. Using "Control Device" value for user/password. --- .../lib/ZoneMinder/Control/FI8908W.pm | 71 ++++++++++--------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm index 6afe64a43..ab877c609 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/FI8908W.pm @@ -20,9 +20,6 @@ # # ========================================================================== # -# This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control -# protocol -# package ZoneMinder::Control::FI8908W; use 5.006; @@ -34,8 +31,6 @@ require ZoneMinder::Control; our @ISA = qw(ZoneMinder::Control); -our $VERSION = $ZoneMinder::Base::VERSION; - # ========================================================================== # # Foscam FI8908W IP Control Protocol @@ -47,16 +42,11 @@ use ZoneMinder::Config qw(:all); use Time::HiRes qw( usleep ); -# To rotate camera one needs "operator" privileges: -our $user = 'operator'; -our $pass = 'secretpassword'; - sub new { my $class = shift; my $id = shift; my $self = ZoneMinder::Control->new( $id ); - my $logindetails = ""; bless( $self, $class ); srand( time() ); return $self; @@ -85,7 +75,7 @@ sub open use LWP::UserAgent; $self->{ua} = LWP::UserAgent->new; - $self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION ); + $self->{ua}->agent( "ZoneMinder Control Agent/".ZoneMinder::Base::ZM_VERSION ); $self->{state} = 'open'; } @@ -110,6 +100,17 @@ sub sendCmd my $self = shift; my $cmd = shift; my $result = undef; + + my ($user, $password) = split /:/, $self->{Monitor}->{ControlDevice}; + + if ( !defined $password ) { + # If value of "Control device" does not consist of two parts, then only password is given and we fallback to default user: + $password = $user; + $user = 'admin'; + } + + $cmd .= "user=$user&pwd=$password"; + printMsg( $cmd, "Tx" ); my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" ); @@ -121,7 +122,7 @@ sub sendCmd } else { - Error( "Error check failed:'".$res->status_line()."'" ); + Error( "Error check failed: '".$res->status_line()."' for URL ".$req->uri() ); } return( $result ); @@ -131,8 +132,7 @@ sub reset { my $self = shift; Debug( "Camera Reset" ); - my $cmd = "reboot.cgi?user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'reboot.cgi?' ); } #Up Arrow @@ -140,8 +140,7 @@ sub moveConUp { my $self = shift; Debug( "Move Up" ); - my $cmd = "decoder_control.cgi?command=0&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=0&' ); } #Down Arrow @@ -149,8 +148,7 @@ sub moveConDown { my $self = shift; Debug( "Move Down" ); - my $cmd = "decoder_control.cgi?command=2&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=2&' ); } #Left Arrow @@ -158,8 +156,7 @@ sub moveConLeft { my $self = shift; Debug( "Move Left" ); - my $cmd = "decoder_control.cgi?command=6&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=6&' ); } #Right Arrow @@ -167,8 +164,7 @@ sub moveConRight { my $self = shift; Debug( "Move Right" ); - my $cmd = "decoder_control.cgi?command=4&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=4&' ); } #Diagonally Up Right Arrow @@ -176,8 +172,7 @@ sub moveConUpRight { my $self = shift; Debug( "Move Diagonally Up Right" ); - my $cmd = "decoder_control.cgi?command=90&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=90&' ); } #Diagonally Down Right Arrow @@ -185,8 +180,7 @@ sub moveConDownRight { my $self = shift; Debug( "Move Diagonally Down Right" ); - my $cmd = "decoder_control.cgi?command=92&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=92&' ); } #Diagonally Up Left Arrow @@ -194,8 +188,7 @@ sub moveConUpLeft { my $self = shift; Debug( "Move Diagonally Up Left" ); - my $cmd = "decoder_control.cgi?command=91&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=91&' ); } #Diagonally Down Left Arrow @@ -203,8 +196,7 @@ sub moveConDownLeft { my $self = shift; Debug( "Move Diagonally Down Left" ); - my $cmd = "decoder_control.cgi?command=93&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=93&' ); } #Stop @@ -212,8 +204,7 @@ sub moveStop { my $self = shift; Debug( "Move Stop" ); - my $cmd = "decoder_control.cgi?user=$user&pwd=$pass&command=1"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=1&' ); } #Move Camera to Home Position @@ -221,8 +212,20 @@ sub presetHome { my $self = shift; Debug( "Home Preset" ); - my $cmd = "decoder_control.cgi?command=25&user=$user&pwd=$pass"; - $self->sendCmd( $cmd ); + $self->sendCmd( 'decoder_control.cgi?command=25&' ); } 1; + +__END__ +=pod + +=head1 DESCRIPTION + +This module contains the implementation of the Foscam FI8908W / FI8918W IP camera control +protocol. + +The module uses "Control Device" value to retrieve user and password. User and password should +be separated by colon, e.g. user:password. If colon is not provided, then "admin" is used +as a fallback value for the user. +=cut From f39667c0cd4ed5632e4cedd4d3e7563271baa696 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Wed, 1 Jan 2014 18:19:42 +0200 Subject: [PATCH 12/29] Fix ZM not compiling with ZM_NO_FFMPEG=ON since #259, closes #285 --- src/zm_rtp_source.cpp | 6 +++++- src/zm_rtp_source.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/zm_rtp_source.cpp b/src/zm_rtp_source.cpp index 0aecd0332..608e529d5 100644 --- a/src/zm_rtp_source.cpp +++ b/src/zm_rtp_source.cpp @@ -24,6 +24,8 @@ #include +#if HAVE_LIBAVCODEC + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) #define _AVCODECID AVCodecID #else @@ -385,4 +387,6 @@ bool RtpSource::getFrame( Buffer &buffer ) return( true ); } -#undef _AVCODECID \ No newline at end of file +#undef _AVCODECID + +#endif // HAVE_LIBAVCODEC diff --git a/src/zm_rtp_source.h b/src/zm_rtp_source.h index 8d1f7da4f..b8a879565 100644 --- a/src/zm_rtp_source.h +++ b/src/zm_rtp_source.h @@ -28,6 +28,8 @@ #include #include +#if HAVE_LIBAVCODEC + #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) #define _AVCODECID AVCodecID #else @@ -189,4 +191,6 @@ public: #undef _AVCODECID +#endif // HAVE_LIBAVCODEC + #endif // ZM_RTP_SOURCE_H From ab06878b7be92c12160432d68e9cc953deab8cb1 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Wed, 1 Jan 2014 15:03:12 -0600 Subject: [PATCH 13/29] Update zoneminder.cmake.f19.spec Add BuildRequires perl(Sys::Syslog) to successfully build with mock --- distros/fedora/zoneminder.cmake.f19.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distros/fedora/zoneminder.cmake.f19.spec b/distros/fedora/zoneminder.cmake.f19.spec index b54805adf..d41d7233c 100644 --- a/distros/fedora/zoneminder.cmake.f19.spec +++ b/distros/fedora/zoneminder.cmake.f19.spec @@ -30,7 +30,7 @@ BuildRequires: perl(ExtUtils::MakeMaker) perl(LWP::UserAgent) BuildRequires: perl(MIME::Entity) perl(MIME::Lite) BuildRequires: perl(PHP::Serialization) perl(Sys::Mmap) BuildRequires: perl(Time::HiRes) perl(Net::SFTP::Foreign) -BuildRequires: perl(Expect) +BuildRequires: perl(Expect) perl(Sys::Syslog) BuildRequires: gcc gcc-c++ %{!?_without_ffmpeg:BuildRequires: ffmpeg-devel} %{!?_without_x10:BuildRequires: perl(X10::ActiveHome) perl(Astro::SunTime)} From 6534aa546c506277661f325159eea2f0fb5ad2c7 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 08:24:58 -0500 Subject: [PATCH 14/29] Fixed readme.debian fstab bind examples After receiving a bug report that the examples did not work, I tried them myself. They did not work, so I updated them to something that does work. --- distros/debian/README.Debian | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/distros/debian/README.Debian b/distros/debian/README.Debian index b8ea413e3..a49b6be72 100644 --- a/distros/debian/README.Debian +++ b/distros/debian/README.Debian @@ -20,18 +20,18 @@ would silently revert the changes and cause event loss - refer bug #608793). If you do want to change the location, here are a couple of suggestions. -(thanks to vagrant@freegeek.org): -These lines in fstab could allow you to bind-mount an alternate location +These lines would mount /dev/sdX1 to /video_storage, and then 'link' /video_storage +to the locations that ZoneMinder expects them to be at. - /dev/sdX1 /otherdrive ext3 defaults 0 2 - /otherdrive/zoneminder/images /var/cache/zoneminder/images bind defaults 0 2 - /otherdrive/zoneminder/events /var/cache/zoneminder/events bind defaults 0 2 + /dev/sdX1 /video_storage ext4 defaults 0 2 + /video_storage/zoneminder/images /var/cache/zoneminder/images none bind 0 2 + /video_storage/zoneminder/events /var/cache/zoneminder/events none bind 0 2 or if you have a separate partition for each: - /dev/sdX1 /var/cache/zoneminder/images ext3 defaults 0 2 - /dev/sdX2 /var/cache/zoneminder/events ext3 defaults 0 2 + /dev/sdX1 /var/cache/zoneminder/images ext4 defaults 0 2 + /dev/sdX2 /var/cache/zoneminder/events ext4 defaults 0 2 From 739b7b3293f20fee58296aff115164c5784f84e6 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 11:45:26 -0500 Subject: [PATCH 15/29] Added a zmfilter after_success test --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5071b7cc9..0105ae14d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,3 +46,4 @@ after_success: - mysql -uzmuser -pzmpass < db/zm_create.sql - mysql -uzmuser -pzmpass zm < db/test.monitor.sql - sudo zmpkg.pl start + - sudo zmfilter.pl -f purgewhenfull From 07b4d83d74c4ef90c6e237f7596570ac22988517 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 11:50:39 -0500 Subject: [PATCH 16/29] Have Usage() in zmcontrol.pl exit 0 instead of -1 --- scripts/zmcontrol.pl.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/zmcontrol.pl.in b/scripts/zmcontrol.pl.in index 77283acc9..e8c78ae84 100644 --- a/scripts/zmcontrol.pl.in +++ b/scripts/zmcontrol.pl.in @@ -49,7 +49,7 @@ sub Usage print( " Usage: zmcontrol.pl --id --command= "); - exit( -1 ); + exit(); } logInit(); From 32286a4869c493b6887b67719d14fe245769d1ad Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 11:51:19 -0500 Subject: [PATCH 17/29] Added a zmcontrol after_success test --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 0105ae14d..775751d85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,3 +47,4 @@ after_success: - mysql -uzmuser -pzmpass zm < db/test.monitor.sql - sudo zmpkg.pl start - sudo zmfilter.pl -f purgewhenfull + - sudo zmcontrol.pl From 337750430bc693207efbce0a16de89a92d24556f Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 12:02:07 -0500 Subject: [PATCH 18/29] Introducing a bug in zmfilter.pl.in to test travis --- 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 1e9f1bbce..3d98fd913 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -172,7 +172,7 @@ chdir( EVENT_PATH ); my $dbh = zmDbConnect(); -if ( $filter_parm ) +if ( $filter_parm { Info( "Scanning for events using filter '$filter_parm'\n" ); } From c5afecc2b4bb5467b0e3faa0e2e860d1040fdfab Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Thu, 2 Jan 2014 12:15:06 -0500 Subject: [PATCH 19/29] Revert "Introducing a bug in zmfilter.pl.in to test travis" This reverts commit 337750430bc693207efbce0a16de89a92d24556f. --- 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 3d98fd913..1e9f1bbce 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -172,7 +172,7 @@ chdir( EVENT_PATH ); my $dbh = zmDbConnect(); -if ( $filter_parm +if ( $filter_parm ) { Info( "Scanning for events using filter '$filter_parm'\n" ); } From 3d55dde5483724daa639c59a6bca0d4234e35fd0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 3 Jan 2014 09:33:49 -0500 Subject: [PATCH 20/29] COnfig fixes --- scripts/zmtrigger.pl.in | 2 +- scripts/zmx10.pl.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 11c5c9a29..1b1477e67 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -53,7 +53,7 @@ use ZoneMinder::Trigger::Connection; my @connections; push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan1", channel=>ZoneMinder::Trigger::Channel::Inet->new( port=>6802 ), mode=>"rw" ) ); -push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>ZM_PATH_SOCKS.'/zmtrigger.sock' ), mode=>"rw" ) ); +push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan2", channel=>ZoneMinder::Trigger::Channel::Unix->new( path=>$Config{ZM_PATH_SOCKS}.'/zmtrigger.sock' ), mode=>"rw" ) ); #push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan3", channel=>ZoneMinder::Trigger::Channel::File->new( path=>'/tmp/zmtrigger.out' ), mode=>"w" ) ); push( @connections, ZoneMinder::Trigger::Connection->new( name=>"Chan4", channel=>ZoneMinder::Trigger::Channel::Serial->new( path=>'/dev/ttyS0' ), mode=>"rw" ) ); diff --git a/scripts/zmx10.pl.in b/scripts/zmx10.pl.in index 14eff5a01..f661e656f 100644 --- a/scripts/zmx10.pl.in +++ b/scripts/zmx10.pl.in @@ -48,7 +48,7 @@ use Socket; use Getopt::Long; use Data::Dumper; -use constant SOCK_FILE => ZM_PATH_SOCKS.'/zmx10.sock'; +use constant SOCK_FILE => $Config{ZM_PATH_SOCKS}.'/zmx10.sock'; $| = 1; From d185f05006d7be849902f169e4e3bc16662c7e37 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 3 Jan 2014 12:55:30 -0500 Subject: [PATCH 21/29] robustness/code style changes --- scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm | 12 +++++++++--- scripts/zmtrigger.pl.in | 5 ++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm index 7c472591d..6af97122c 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Memory/Mapped.pm @@ -76,8 +76,11 @@ sub zmMemKey( $ ) sub zmMemAttach( $$ ) { - my $monitor = shift; - my $size = shift; + my ( $monitor, $size ) = @_; + if ( ! $size ) { + Error( "No size passed to zmMemAttach for monitor $$monitor{Id}\n" ); + return( undef ); + } if ( !defined($monitor->{MMapAddr}) ) { my $mmap_file = $Config{ZM_PATH_MAP}."/zm.mmap.".$monitor->{Id}; @@ -95,6 +98,7 @@ sub zmMemAttach( $$ ) if ( !$mmap_addr || !$mmap ) { Error( sprintf( "Can't mmap to file '%s': $!\n", $mmap_file ) ); + close( MMAP ); return( undef ); } $monitor->{MMapHandle} = \*MMAP; @@ -110,7 +114,9 @@ sub zmMemDetach( $ ) if ( $monitor->{MMap} ) { - munmap( ${$monitor->{MMap}} ); + if ( ! munmap( ${$monitor->{MMap}} ) ) { + Warn( "Unable to munmap for monitor $$monitor{Id}\n"); + } delete $monitor->{MMap}; } if ( $monitor->{MMapAddr} ) diff --git a/scripts/zmtrigger.pl.in b/scripts/zmtrigger.pl.in index 1b1477e67..d8929fab3 100644 --- a/scripts/zmtrigger.pl.in +++ b/scripts/zmtrigger.pl.in @@ -437,4 +437,7 @@ sub handleMessage { Error( "Unrecognised action '$action' in message '$message'\n" ); } -} +} # end sub handleMessage + +1; +__END__ From 6e5d9272e03783683f9db1665e63e84cdc506a68 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 3 Jan 2014 18:33:01 -0500 Subject: [PATCH 22/29] supposed to fix #296 --- web/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/index.php b/web/index.php index 530e7f2c8..46c173421 100644 --- a/web/index.php +++ b/web/index.php @@ -105,11 +105,11 @@ if ( isset($_REQUEST['request']) ) if ( isset($_REQUEST['action']) ) $action = detaintPath($_REQUEST['action']); -require_once( 'includes/actions.php' ); - foreach ( getSkinIncludes( 'skin.php' ) as $includeFile ) require_once $includeFile; +require_once( 'includes/actions.php' ); + if ( isset( $_REQUEST['request'] ) ) { foreach ( getSkinIncludes( 'ajax/'.$request.'.php', true, true ) as $includeFile ) From 2b789332c8990ce8b9103e684c942a45c39c65d5 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 14:44:12 -0500 Subject: [PATCH 23/29] Initial commit of perl test script for travis builds --- utils/travis.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 utils/travis.pl diff --git a/utils/travis.pl b/utils/travis.pl new file mode 100644 index 000000000..f9c74bbc6 --- /dev/null +++ b/utils/travis.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my @tests = ( + 'zmpkg.pl start', + 'zmfilter.pl -f purgewhenfull', +); + +sub run_test { + my $test = $_[0]; + print "Running test: '$test'"; + + my @args = ('sudo', $test); + system(@args) == 0 or die "'$test' failed to run!"; +} + +foreach my $test (@tests) { + run_test($test); +} From 0bf4122016710ec762aadfe784d076342a351600 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 14:45:22 -0500 Subject: [PATCH 24/29] Set execute bit on travis.pl --- utils/travis.pl | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 utils/travis.pl diff --git a/utils/travis.pl b/utils/travis.pl old mode 100644 new mode 100755 From d92d1007847d1a15f54a7876d3ecd55f30e11adf Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 14:48:13 -0500 Subject: [PATCH 25/29] Move travis db creative to before_script --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 775751d85..88307edc3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,9 @@ before_script: - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoheader; fi - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then automake --force-missing --add-missing; fi - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then autoconf; fi + - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm" + - mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'"; + - mysql -uroot -e "FLUSH PRIVILEGES" script: - if [ "$ZM_BUILDMETHOD" = "autotools" ]; then ./configure --prefix=/usr --with-libarch=lib/$DEB_HOST_GNU_TYPE --host=$DEB_HOST_GNU_TYPE --build=$DEB_BUILD_GNU_TYPE --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/usr/share/zoneminder/www --with-cgidir=/usr/libexec/zoneminder/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-crashtrace=yes --disable-debug --enable-mmap=yes ZM_SSL_LIB=openssl; fi - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DCMAKE_INSTALL_PREFIX="/usr"; fi @@ -40,9 +43,6 @@ script: - sudo make install after_success: - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi - - mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm" - - mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'"; - - mysql -uroot -e "FLUSH PRIVILEGES" - mysql -uzmuser -pzmpass < db/zm_create.sql - mysql -uzmuser -pzmpass zm < db/test.monitor.sql - sudo zmpkg.pl start From ec9efc22c466e24b8eb0acd3f4670307400ac6ec Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 14:54:15 -0500 Subject: [PATCH 26/29] move after_success test to success in .travis.yml --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 88307edc3..b9a528876 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,10 +41,8 @@ script: - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DCMAKE_INSTALL_PREFIX="/usr"; fi - make - sudo make install -after_success: - if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi - mysql -uzmuser -pzmpass < db/zm_create.sql - mysql -uzmuser -pzmpass zm < db/test.monitor.sql - sudo zmpkg.pl start - sudo zmfilter.pl -f purgewhenfull - - sudo zmcontrol.pl From acc158f3cb941802d6189dd36891efd88d320d78 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 15:04:14 -0500 Subject: [PATCH 27/29] Broke zmfilter.pl.in in order to test travis --- scripts/zmfilter.pl.in | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index 1e9f1bbce..0f35a29d2 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -248,6 +248,7 @@ sub getLoad sub getFilters { + exit(1); my $filter_name = shift; my @filters; From faaf2377317b1728f3f0b10b55478297e3379762 Mon Sep 17 00:00:00 2001 From: Kyle Johnson Date: Sat, 4 Jan 2014 15:10:15 -0500 Subject: [PATCH 28/29] Revert "Broke zmfilter.pl.in in order to test travis" This reverts commit acc158f3cb941802d6189dd36891efd88d320d78. --- scripts/zmfilter.pl.in | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/zmfilter.pl.in b/scripts/zmfilter.pl.in index 0f35a29d2..1e9f1bbce 100644 --- a/scripts/zmfilter.pl.in +++ b/scripts/zmfilter.pl.in @@ -248,7 +248,6 @@ sub getLoad sub getFilters { - exit(1); my $filter_name = shift; my @filters; From a96281562450d0f6f51defe138c34e838c35ac69 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 5 Jan 2014 08:59:09 +0200 Subject: [PATCH 29/29] Change default alarm blend percent to 6 and make upgrades smooth by copying the existing blend percent to the alarm one --- db/zm_create.sql.in | 2 +- db/zm_update-1.26.5.sql | 4 +++- web/skins/classic/views/monitor.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/db/zm_create.sql.in b/db/zm_create.sql.in index cb0420a13..05353cb7f 100644 --- a/db/zm_create.sql.in +++ b/db/zm_create.sql.in @@ -353,7 +353,7 @@ CREATE TABLE `Monitors` ( `AlarmMaxFPS` decimal(5,2) default NULL, `FPSReportInterval` smallint(5) unsigned NOT NULL default '250', `RefBlendPerc` tinyint(3) unsigned NOT NULL default '6', - `AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '3', + `AlarmRefBlendPerc` tinyint(3) unsigned NOT NULL default '6', `Controllable` tinyint(3) unsigned NOT NULL default '0', `ControlId` int(10) unsigned NOT NULL default '0', `ControlDevice` varchar(255) default NULL, diff --git a/db/zm_update-1.26.5.sql b/db/zm_update-1.26.5.sql index 7c70d85b7..bffa09129 100644 --- a/db/zm_update-1.26.5.sql +++ b/db/zm_update-1.26.5.sql @@ -14,10 +14,12 @@ SET @s = (SELECT IF( AND column_name = 'AlarmRefBlendPerc' ) > 0, "SELECT 1", -"ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '3' AFTER `RefBlendPerc`" +"ALTER TABLE `Monitors` ADD `AlarmRefBlendPerc` TINYINT(3) UNSIGNED NOT NULL DEFAULT '6' AFTER `RefBlendPerc`" )); PREPARE stmt FROM @s; EXECUTE stmt; +UPDATE `Monitors` SET `AlarmRefBlendPerc` = `RefBlendPerc`; + diff --git a/web/skins/classic/views/monitor.php b/web/skins/classic/views/monitor.php index c5a2c91ff..13a92dde6 100644 --- a/web/skins/classic/views/monitor.php +++ b/web/skins/classic/views/monitor.php @@ -96,7 +96,7 @@ else 'AlarmMaxFPS' => "", 'FPSReportInterval' => 1000, 'RefBlendPerc' => 6, - 'AlarmRefBlendPerc' => 3, + 'AlarmRefBlendPerc' => 6, 'DefaultView' => 'Events', 'DefaultRate' => '100', 'DefaultScale' => '100',