Merge branch 'master' into storageareas

This commit is contained in:
Isaac Connor 2017-07-13 11:04:51 -04:00
commit 0df6ac2895
5 changed files with 83 additions and 77 deletions

View File

@ -297,6 +297,7 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_unitdir}/zoneminder.service %{_unitdir}/zoneminder.service
%{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy %{_datadir}/polkit-1/actions/com.zoneminder.systemctl.policy
%{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules %{_datadir}/polkit-1/rules.d/com.zoneminder.systemctl.rules
%{_bindir}/zmsystemctl.pl
%endif %endif
%if 0%{?with_init_sysv} %if 0%{?with_init_sysv}
@ -318,7 +319,6 @@ rm -rf %{_docdir}/%{name}-%{version}
%{_bindir}/zmvideo.pl %{_bindir}/zmvideo.pl
%{_bindir}/zmwatch.pl %{_bindir}/zmwatch.pl
%{_bindir}/zmcamtool.pl %{_bindir}/zmcamtool.pl
%{_bindir}/zmsystemctl.pl
%{_bindir}/zmtelemetry.pl %{_bindir}/zmtelemetry.pl
%{_bindir}/zmx10.pl %{_bindir}/zmx10.pl
%{_bindir}/zmonvif-probe.pl %{_bindir}/zmonvif-probe.pl

View File

@ -79,8 +79,8 @@ function getPopupSize( tag, width, height ) {
popupSize.height = height; popupSize.height = height;
Error( "Got passed height but no addHeight when getting popup size for tag '"+tag+"'" ); Error( "Got passed height but no addHeight when getting popup size for tag '"+tag+"'" );
} }
if ( popupSize.minHeight && popupSize.height < popupSize.minHeight ) { if ( popupSize.minHeight && ( popupSize.height < popupSize.minHeight ) ) {
Warning( "Adjusting to minimum height when getting popup size for tag '"+tag+"'" ); Warning( "Adjusting to minimum height ("+popupSize.minHeight+") when getting popup size for tag '"+tag+"' because calculated height is " + popupSize.height );
popupSize.height = popupSize.minHeight; popupSize.height = popupSize.minHeight;
} }
Debug( popupSize ); Debug( popupSize );
@ -293,4 +293,3 @@ function addVideoTimingTrack(video, LabelFormat, monitorName, duration, startTim
track.src = 'data:plain/text;charset=utf-8,'+encodeURIComponent(webvttdata); track.src = 'data:plain/text;charset=utf-8,'+encodeURIComponent(webvttdata);
video.appendChild(track); video.appendChild(track);
} }

View File

@ -34,8 +34,7 @@ require_once( $skinJsPhpFile );
<script type="text/javascript" src="<?php echo $skinJsFile ?>"></script> <script type="text/javascript" src="<?php echo $skinJsFile ?>"></script>
<script type="text/javascript"> <script type="text/javascript">
<?php <?php
if ( !$debug ) if ( !$debug ) {
{
?> ?>
closeWindow(); closeWindow();
<?php <?php

View File

@ -19,8 +19,8 @@
// //
if ( !canEdit( 'Monitors' ) ) { if ( !canEdit( 'Monitors' ) ) {
$view = 'error'; $view = 'error';
return; return;
} }
$cameras = array(); $cameras = array();
@ -40,78 +40,81 @@ function execONVIF( $cmd ) {
$html_output<br/><br/> $html_output<br/><br/>
Please the following command from a command line for more information:<br/><br/>$shell_command" Please the following command from a command line for more information:<br/><br/>$shell_command"
); );
} else {
Logger::Debug( "Results from probe: " . implode( '<br/>', $output ) );
} }
return $output; return $output;
} }
function probeCameras( $localIp ) { function probeCameras( $localIp ) {
$cameras = array(); $cameras = array();
$count = 0; if ( $lines = @execONVIF( 'probe' ) ) {
if ( $lines = @execONVIF( 'probe' ) ) { foreach ( $lines as $line ) {
foreach ( $lines as $line ) { $line = rtrim( $line );
$line = rtrim( $line ); if ( preg_match( '|^(.+),(.+),\s\((.*)\)$|', $line, $matches ) ) {
if ( preg_match( '|^(.+),(.+),\s\((.*)\)$|', $line, $matches ) ) { $device_ep = $matches[1];
$device_ep = $matches[1]; $soapversion = $matches[2];
$soapversion = $matches[2]; $camera = array(
$camera = array( 'model' => 'Unknown ONVIF Camera',
'model' => "Unknown ONVIF Camera", 'monitor' => array(
'monitor' => array( 'Function' => 'Monitor',
'Function' => "Monitor", 'Type' => 'Ffmpeg',
'Type' => 'Ffmpeg', 'Host' => $device_ep,
'Host' => $device_ep, 'SOAP' => $soapversion,
'SOAP' => $soapversion, ),
), );
); foreach ( preg_split('|,\s*|', $matches[3]) as $attr_val ) {
foreach ( preg_split('|,\s*|', $matches[3]) as $attr_val ) { if ( preg_match( '|(.+)=\'(.*)\'|', $attr_val, $tokens ) ) {
if( preg_match( '|(.+)=\'(.*)\'|', $attr_val, $tokens ) ) { if ( $tokens[1] == 'hardware' ) {
if($tokens[1] == "hardware") { $camera['model'] = $tokens[2];
$camera['model'] = $tokens[2]; } elseif ( $tokens[1] == 'name' ) {
} elseif($tokens[1] == "name") { $camera['monitor']['Name'] = $tokens[2];
$camera['monitor']['Name'] = $tokens[2]; } elseif ( $tokens[1] == 'location' ) {
} elseif($tokens[1] == "location") { // $camera['location'] = $tokens[2];
// $camera['location'] = $tokens[2]; } else {
} Logger::Debug('Unknown token ' . $tokens[1] );
}
}
$cameras[$count ++] = $camera;
} }
} }
} } // end foreach token
return( $cameras ); $cameras[] = $camera;
}
} // end foreach line
}
return( $cameras );
} }
function probeProfiles( $device_ep, $soapversion, $username, $password ) { function probeProfiles( $device_ep, $soapversion, $username, $password ) {
$profiles = array(); $profiles = array();
$count = 0; if ( $lines = @execONVIF( "profiles $device_ep $soapversion $username $password" ) ) {
if ( $lines = @execONVIF( "profiles $device_ep $soapversion $username $password" ) ) { foreach ( $lines as $line ) {
foreach ( $lines as $line ) { $line = rtrim( $line );
$line = rtrim( $line ); if ( preg_match( '|^(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+)\s*$|', $line, $matches ) ) {
if ( preg_match( '|^(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+),\s*(.+)\s*$|', $line, $matches ) ) { $stream_uri = $matches[7];
$stream_uri = $matches[7]; // add user@pass to URI
// add user@pass to URI if ( preg_match( '|^(\S+://)(.+)$|', $stream_uri, $tokens ) ) {
if( preg_match( '|^(\S+://)(.+)$|', $stream_uri, $tokens ) ) { $stream_uri = $tokens[1].$username.':'.$password.'@'.$tokens[2];
$stream_uri = $tokens[1].$username.':'.$password.'@'.$tokens[2]; }
}
$profile = array( # 'monitor' part of camera
$profile = array( # 'monitor' part of camera 'Type' => 'Ffmpeg',
'Type' => 'Ffmpeg', 'Width' => $matches[4],
'Width' => $matches[4], 'Height' => $matches[5],
'Height' => $matches[5], 'MaxFPS' => $matches[6],
'MaxFPS' => $matches[6], 'Path' => $stream_uri,
'Path' => $stream_uri, // local-only:
// local-only: 'Profile' => $matches[1],
'Profile' => $matches[1], 'Name' => $matches[2],
'Name' => $matches[2], 'Encoding' => $matches[3],
'Encoding' => $matches[3],
);
); $profiles[] = $profile;
$profiles[$count ++] = $profile; } else {
} Logger::Debug("Line did not match preg: $line");
} }
} }
return( $profiles ); }
return( $profiles );
} }

View File

@ -19,7 +19,7 @@
// //
if ( !canEdit( 'System' ) ) { if ( !canEdit( 'System' ) ) {
$view = "error"; $view = 'error';
return; return;
} }
?> ?>
@ -41,18 +41,23 @@ if ( !canEdit( 'System' ) ) {
<div class="col-sm-9"> <div class="col-sm-9">
<select id="runState" name="runState" class="form-control"> <select id="runState" name="runState" class="form-control">
<?php <?php
if ( $running ) { ?> if ( $running ) {
?>
<option value="stop" selected="selected"><?php echo translate('Stop') ?></option> <option value="stop" selected="selected"><?php echo translate('Stop') ?></option>
<option value="restart"><?php echo translate('Restart') ?></option> <option value="restart"><?php echo translate('Restart') ?></option>
<?php } else { ?> <?php
<option value="start" selected="selected"><?php echo translate('Start') ?></option> } else {
<?php }
?> ?>
<?php <option value="start" selected="selected"><?php echo translate('Start') ?></option>
<?php
}
$states = dbFetchAll( 'SELECT * FROM States' ); $states = dbFetchAll( 'SELECT * FROM States' );
foreach ( $states as $state ) { ?> foreach ( $states as $state ) {
?>
<option value="<?php echo $state['Name'] ?>"><?php echo $state['Name'] ?></option> <option value="<?php echo $state['Name'] ?>"><?php echo $state['Name'] ?></option>
<?php } ?> <?php
}
?>
</select> </select>
</div><!--col-sm-9--> </div><!--col-sm-9-->
</div><!--form-group--> </div><!--form-group-->