Merge ../ZoneMinder.connortechnology
This commit is contained in:
commit
fcaac016b5
|
@ -713,7 +713,7 @@ CREATE TABLE `Storage` (
|
|||
--
|
||||
-- Create a default storage location
|
||||
--
|
||||
insert into Storage VALUES (NULL, '/var/cache/zoneminder/events', 'Default', 'local', NULL, 'Medium', 0 );
|
||||
insert into Storage VALUES (NULL, '@ZM_DIR_EVENTS@', 'Default', 'local', NULL, NULL, 'Medium', 0, true );
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
|
|
@ -397,7 +397,7 @@ sub delete {
|
|||
if ( (! $Config{ZM_OPT_FAST_DELETE}) and $event->Storage()->DoDelete() ) {
|
||||
$event->delete_files( );
|
||||
} else {
|
||||
Debug('Not deleting frames, stats and files for speed.');
|
||||
Debug('Not deleting event files for speed.');
|
||||
}
|
||||
} # end sub delete
|
||||
|
||||
|
@ -519,6 +519,23 @@ sub DiskSpace {
|
|||
sub MoveTo {
|
||||
my ( $self, $NewStorage ) = @_;
|
||||
|
||||
my $OldStorage = $self->Storage(undef);
|
||||
my ( $OldPath ) = ( $self->Path() =~ /^(.*)$/ ); # De-taint
|
||||
if ( ! -e $OldPath ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "Old path $OldPath does not exist.";
|
||||
}
|
||||
# First determine if we can move it to the dest.
|
||||
# We do this before bothering to lock the event
|
||||
my ( $NewPath ) = ( $NewStorage->Path() =~ /^(.*)$/ ); # De-taint
|
||||
if ( ! $$NewStorage{Id} ) {
|
||||
return "New storage does not have an id. Moving will not happen.";
|
||||
} elsif ( !$NewPath ) {
|
||||
return "New path ($NewPath) is empty.";
|
||||
} elsif ( ! -e $NewPath ) {
|
||||
return "New path $NewPath does not exist.";
|
||||
}
|
||||
|
||||
$ZoneMinder::Database::dbh->begin_work();
|
||||
$self->lock_and_load();
|
||||
# data is reloaded, so need to check that the move hasn't already happened.
|
||||
|
@ -526,25 +543,13 @@ sub MoveTo {
|
|||
$ZoneMinder::Database::dbh->commit();
|
||||
return "Event has already been moved by someone else.";
|
||||
}
|
||||
my $OldStorage = $self->Storage(undef);
|
||||
my ( $OldPath ) = ( $self->Path() =~ /^(.*)$/ ); # De-taint
|
||||
|
||||
if ( $$OldStorage{Id} != $$self{StorageId} ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "Old Storage path changed, Event has moved somewhere else.";
|
||||
}
|
||||
|
||||
$$self{Storage} = $NewStorage;
|
||||
|
||||
my ( $NewPath ) = ( $NewStorage->Path() =~ /^(.*)$/ ); # De-taint
|
||||
if ( ! $$NewStorage{Id} ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "New storage does not have an id. Moving will not happen.";
|
||||
} elsif ( !$NewPath ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "New path ($NewPath) is empty.";
|
||||
} elsif ( ! -e $NewPath ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "New path $NewPath does not exist.";
|
||||
} elsif ( ! -e $OldPath ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
return "Old path $OldPath does not exist.";
|
||||
}
|
||||
( $NewPath ) = ( $self->Path(undef) =~ /^(.*)$/ ); # De-taint
|
||||
if ( $NewPath eq $OldPath ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
|
|
|
@ -113,6 +113,15 @@ sub Name {
|
|||
return $_[0]{Name};
|
||||
} # end sub Path
|
||||
|
||||
sub DoDelete {
|
||||
my $self = shift;
|
||||
$$self{DoDelete} = shift if @_;
|
||||
if ( ! defined $$self{DoDelete} ) {
|
||||
$$self{DoDelete} = 1;
|
||||
}
|
||||
return $$self{DoDelete};
|
||||
}
|
||||
|
||||
sub Server {
|
||||
my $self = shift;
|
||||
if ( ! $$self{Server} ) {
|
||||
|
|
|
@ -677,6 +677,11 @@ int FfmpegCamera::Close() {
|
|||
mFormatContext = NULL;
|
||||
}
|
||||
|
||||
if ( videoStore ) {
|
||||
delete videoStore;
|
||||
videoStore = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} // end FfmpegCamera::Close
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ if ( sem_acquire($semaphore,1) !== false ) {
|
|||
}
|
||||
case MSG_DATA_EVENT :
|
||||
{
|
||||
$data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg );
|
||||
$data = unpack( "ltype/Pevent/iprogress/irate/izoom/Cpaused", $msg );
|
||||
//$data['progress'] = sprintf( "%.2f", $data['progress'] );
|
||||
$data['rate'] /= RATE_BASE;
|
||||
$data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 );
|
||||
|
|
|
@ -211,7 +211,7 @@ class Group {
|
|||
$group_options = array();
|
||||
foreach ( $Groups as $id=>$Group ) {
|
||||
if ( ! $Group->ParentId() ) {
|
||||
$group_options += get_options( $Group );
|
||||
$group_options += get_options($Group);
|
||||
}
|
||||
}
|
||||
return $group_options;
|
||||
|
@ -280,6 +280,4 @@ public function Parents() {
|
|||
}
|
||||
|
||||
} # end class Group
|
||||
|
||||
|
||||
?>
|
||||
|
|
|
@ -564,7 +564,14 @@ if ( canEdit( 'Monitors' ) ) {
|
|||
Error("Users with Monitors restrictions cannot create new monitors.");
|
||||
return;
|
||||
}
|
||||
if ( count($_POST['newMonitor']['GroupIds']) != count($Monitor->GroupIds()) or array_diff($_POST['newMonitor']['GroupIds'], $Monitor->GroupIds() ) ) {
|
||||
|
||||
if (
|
||||
( !isset($_POST['newMonitor']['GroupIds']) )
|
||||
or
|
||||
( count($_POST['newMonitor']['GroupIds']) != count($Monitor->GroupIds()) )
|
||||
or
|
||||
array_diff($_POST['newMonitor']['GroupIds'], $Monitor->GroupIds())
|
||||
) {
|
||||
if ( $Monitor->Id() )
|
||||
dbQuery('DELETE FROM Groups_Monitors WHERE MonitorId=?', array($mid));
|
||||
|
||||
|
|
|
@ -164,16 +164,16 @@ function dbFetchOne( $sql, $col=false, $params=NULL ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( $result && $dbRow = $result->fetch( PDO::FETCH_ASSOC ) ) {
|
||||
if ( $result && $dbRow = $result->fetch(PDO::FETCH_ASSOC) ) {
|
||||
if ( $col ) {
|
||||
if ( ! isset( $dbRow[$col] ) ) {
|
||||
Warning( "$col does not exist in the returned row " . print_r($dbRow, true) );
|
||||
if ( ! array_key_exists($col, $dbRow) ) {
|
||||
Warning("$col does not exist in the returned row " . print_r($dbRow, true));
|
||||
}
|
||||
return $dbRow[$col];
|
||||
}
|
||||
return $dbRow;
|
||||
}
|
||||
return( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
function dbFetchAll( $sql, $col=false, $params=NULL ) {
|
||||
|
|
|
@ -2132,7 +2132,7 @@ function getStreamHTML( $monitor, $options = array() ) {
|
|||
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||
$streamSrc = $monitor->getStreamSrc( array(
|
||||
'mode'=>'mpeg',
|
||||
'scale'=>$options['scale'],
|
||||
'scale'=>(isset($options['scale'])?$options['scale']:100),
|
||||
'bitrate'=>ZM_WEB_VIDEO_BITRATE,
|
||||
'maxfps'=>ZM_WEB_VIDEO_MAXFPS,
|
||||
'format' => ZM_MPEG_LIVE_FORMAT
|
||||
|
|
|
@ -249,9 +249,11 @@ if ( $fclass != 'infoText' ) $dot_class=$fclass;
|
|||
<span class="glyphicon glyphicon-dot <?php echo $dot_class ?>" aria-hidden="true"></span><a <?php echo ($stream_available ? 'href="?view=watch&mid='.$monitor['Id'].'">' : '>') . $monitor['Name'] ?></a><br/><div class="small text-nowrap text-muted">
|
||||
<?php echo implode('<br/>',
|
||||
array_map(function($group_id){
|
||||
$Group = new Group($group_id);
|
||||
$Groups = $Group->Parents();
|
||||
array_push( $Groups, $Group );
|
||||
$Group = Group::find_one(array('Id'=>$group_id));
|
||||
if ( $Group ) {
|
||||
$Groups = $Group->Parents();
|
||||
array_push( $Groups, $Group );
|
||||
}
|
||||
return implode(' > ', array_map(function($Group){ return '<a href="'. ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=montagereview&GroupId='.$Group->Id().'">'.$Group->Name().'</a>'; }, $Groups ));
|
||||
}, $Monitor->GroupIds() ) );
|
||||
?>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
function setButtonState( element, butClass ) {
|
||||
element.className = butClass;
|
||||
element.disabled = (butClass != 'inactive');
|
||||
function setButtonState(element, butClass) {
|
||||
if ( element ) {
|
||||
element.className = butClass;
|
||||
element.disabled = (butClass != 'inactive');
|
||||
}
|
||||
}
|
||||
|
||||
function showEvents() {
|
||||
|
|
|
@ -98,7 +98,7 @@ $EventsByMonitor = array();
|
|||
while( $event = $result->fetch(PDO::FETCH_ASSOC) ) {
|
||||
$Event = new Event($event);
|
||||
if ( ! isset($EventsByMonitor[$event['MonitorId']]) )
|
||||
$EventsByMonitor[$event['MonitorId']] = array( 'Events'=>array(), 'MinGap'=>0, 'MaxGap'=>0, 'FileMissing'=>0, );
|
||||
$EventsByMonitor[$event['MonitorId']] = array( 'Events'=>array(), 'MinGap'=>0, 'MaxGap'=>0, 'FileMissing'=>0, 'ZeroSize'=>0 );
|
||||
|
||||
if ( count($EventsByMonitor[$event['MonitorId']]['Events']) ) {
|
||||
$last_event = end($EventsByMonitor[$event['MonitorId']]['Events']);
|
||||
|
@ -112,6 +112,8 @@ while( $event = $result->fetch(PDO::FETCH_ASSOC) ) {
|
|||
} # end if has previous events
|
||||
if ( ! file_exists( $Event->Path().'/'.$Event->DefaultVideo() ) ) {
|
||||
$EventsByMonitor[$event['MonitorId']]['FileMissing'] += 1;
|
||||
} else if ( ! filesize( $Event->Path().'/'.$Event->DefaultVideo() ) ) {
|
||||
$EventsByMonitor[$event['MonitorId']]['ZeroSize'] += 1;
|
||||
}
|
||||
$EventsByMonitor[$event['MonitorId']]['Events'][] = $Event;
|
||||
} # end foreach event
|
||||
|
@ -142,6 +144,7 @@ while( $event = $result->fetch(PDO::FETCH_ASSOC) ) {
|
|||
<th class="colMinGap"><?php echo translate('MinGap') ?></th>
|
||||
<th class="colMaxGap"><?php echo translate('MaxGap') ?></th>
|
||||
<th class="colMissingFiles"><?php echo translate('MissingFiles') ?></th>
|
||||
<th class="colZeroSize"><?php echo translate('ZeroSize') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -169,6 +172,7 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
|||
<td class="colMinGap"><?php echo isset($EventsByMonitor[$Monitor->Id()])?$EventsByMonitor[$Monitor->Id()]['MinGap']:0 ?></td>
|
||||
<td class="colMaxGap"><?php echo isset($EventsByMonitor[$Monitor->Id()])?$EventsByMonitor[$Monitor->Id()]['MaxGap']:0 ?></td>
|
||||
<td class="colFileMissing"><?php echo isset($EventsByMonitor[$Monitor->Id()])?$EventsByMonitor[$Monitor->Id()]['FileMissing']:0 ?></td>
|
||||
<td class="colZeroSize"><?php echo isset($EventsByMonitor[$Monitor->Id()])?$EventsByMonitor[$Monitor->Id()]['ZeroSize']:0 ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
} # end for each monitor
|
||||
|
|
|
@ -54,7 +54,6 @@ if ( isset( $_REQUEST['scale'] ) ) {
|
|||
$connkey = generateConnKey();
|
||||
|
||||
$streamMode = getStreamMode();
|
||||
$showDvrControls = ( $streamMode == 'jpeg' && $monitor->StreamReplayBuffer() != 0 );
|
||||
|
||||
noCacheHeaders();
|
||||
|
||||
|
@ -97,15 +96,31 @@ if ( canEdit( 'Monitors' ) ) {
|
|||
?>
|
||||
<div id="monitorState"><?php echo translate('State') ?>: <span id="stateValue"></span> - <span id="fpsValue"></span> fps</div>
|
||||
</div>
|
||||
<div id="dvrControls"<?php echo $showDvrControls?'':' class="hidden"' ?>>
|
||||
<input type="button" value="<<" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastRev( true )"/>
|
||||
<input type="button" value="<" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowRev( true )"/>
|
||||
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" onclick="streamCmdPause( true )"/>
|
||||
<input type="button" value="[]" id="stopBtn" title="<?php echo translate('Stop') ?>" class="unavail" disabled="disabled" onclick="streamCmdStop( true )"/>
|
||||
<input type="button" value="|>" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" onclick="streamCmdPlay( true )"/>
|
||||
<input type="button" value=">" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowFwd( true )"/>
|
||||
<input type="button" value=">>" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastFwd( true )"/>
|
||||
<div id="dvrControls">
|
||||
<?php
|
||||
if ( $streamMode == 'jpeg' ) {
|
||||
if ( $monitor->StreamReplayBuffer() != 0 ) {
|
||||
?>
|
||||
<input type="button" value="<<" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastRev(true)"/>
|
||||
<input type="button" value="<" id="slowRevBtn" title="<?php echo translate('StepBack') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowRev(true)"/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="button" value="||" id="pauseBtn" title="<?php echo translate('Pause') ?>" class="inactive" onclick="streamCmdPause(true)"/>
|
||||
<input type="button" value="[]" id="stopBtn" title="<?php echo translate('Stop') ?>" class="unavail" disabled="disabled" onclick="streamCmdStop(true)"/>
|
||||
<input type="button" value="|>" id="playBtn" title="<?php echo translate('Play') ?>" class="active" disabled="disabled" onclick="streamCmdPlay(true)"/>
|
||||
<?php
|
||||
if ( $monitor->StreamReplayBuffer() != 0 ) {
|
||||
?>
|
||||
<input type="button" value=">" id="slowFwdBtn" title="<?php echo translate('StepForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdSlowFwd(true)"/>
|
||||
<input type="button" value=">>" id="fastFwdBtn" title="<?php echo translate('FastForward') ?>" class="unavail" disabled="disabled" onclick="streamCmdFastFwd(true)"/>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<input type="button" value="–" id="zoomOutBtn" title="<?php echo translate('ZoomOut') ?>" class="avail" onclick="streamCmdZoomOut()"/>
|
||||
<?php
|
||||
} // end if streamMode==jpeg
|
||||
?>
|
||||
</div>
|
||||
<div id="replayStatus"<?php echo $streamMode=="single"?' class="hidden"':'' ?>>
|
||||
<span id="mode"><?php echo translate('Mode') ?>: <span id="modeValue"></span></span>
|
||||
|
|
Loading…
Reference in New Issue