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

View File

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

View File

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

View File

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