mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-23 06:48:24 -04:00
Bug 447 - Added getEventPath function and changed scripts to use it.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2302 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
1 parent
d0fdcec204
commit
b6fc0b2628
3 files changed
+22
-13
No files matched your search
@@ -43,6 +43,7 @@ our @ISA = qw(Exporter ZoneMinder::Base);
|
||||
our %EXPORT_TAGS = (
|
||||
'functions' => [ qw(
|
||||
executeShellCommand
|
||||
getEventPath
|
||||
deleteEventFiles
|
||||
) ]
|
||||
);
|
||||
@@ -76,6 +77,22 @@ sub executeShellCommand( $ )
|
||||
}
|
||||
}
|
||||
|
||||
sub getEventPath( $ )
|
||||
{
|
||||
my $event = shift;
|
||||
|
||||
my $event_path = "";
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
{
|
||||
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
}
|
||||
return( $event_path );
|
||||
}
|
||||
|
||||
sub deleteEventFiles( $;$ )
|
||||
{
|
||||
#
|
||||
|
||||
+4
-4
@@ -710,7 +710,7 @@ sub uploadArchFile
|
||||
my $event = shift;
|
||||
|
||||
my $arch_file = ZM_UPLOAD_FTP_LOC_DIR.'/'.$event->{MonitorName}.'-'.$event->{Id};
|
||||
my $arch_image_path = "$event->{MonitorId}/$event->{Id}/".((ZM_UPLOAD_ARCH_ANALYSE)?'{*analyse,*capture}':'*capture').".jpg";
|
||||
my $arch_image_path = getEventPath( $event )."/".((ZM_UPLOAD_ARCH_ANALYSE)?'{*analyse,*capture}':'*capture').".jpg";
|
||||
my $arch_error;
|
||||
|
||||
if ( ZM_UPLOAD_ARCH_FORMAT eq "zip" )
|
||||
@@ -860,14 +860,14 @@ sub substituteTags
|
||||
$text =~ s/%EPIM%/$url?view=frame&mid=$event->{MonitorId}&eid=$event->{Id}&fid=$max_alarm_frame->{FrameId}/g;
|
||||
if ( $attachments_ref && $text =~ s/%EI1%//g )
|
||||
{
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%d/%d/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $event->{MonitorId}, $event->{Id}, $first_alarm_frame->{FrameId} ) } );
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $first_alarm_frame->{FrameId} ) } );
|
||||
}
|
||||
if ( $attachments_ref && $text =~ s/%EIM%//g )
|
||||
{
|
||||
# Don't attach the same image twice
|
||||
if ( !@$attachments_ref || ($first_alarm_frame->{FrameId} != $max_alarm_frame->{FrameId} ) )
|
||||
{
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%d/%d/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", $event->{MonitorId}, $event->{Id}, $max_alarm_frame->{FrameId} ) } );
|
||||
push( @$attachments_ref, { type=>"image/jpeg", path=>sprintf( "%s/%0".ZM_EVENT_IMAGE_DIGITS."d-capture.jpg", getEventPath( $event ), $max_alarm_frame->{FrameId} ) } );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1092,7 +1092,7 @@ sub executeCommand
|
||||
my $filter = shift;
|
||||
my $event = shift;
|
||||
|
||||
my $event_path = "$event->{MonitorId}/$event->{Id}";
|
||||
my $event_path = getEventPath( $event );
|
||||
|
||||
my $command = $filter->{AutoExecuteCmd};
|
||||
$command .= " $event_path";
|
||||
|
||||
+1
-9
@@ -166,15 +166,7 @@ my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->
|
||||
my $res = $sth->execute() or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
my $event = $sth->fetchrow_hashref();
|
||||
$sth->finish();
|
||||
my $event_path;
|
||||
if ( ZM_USE_DEEP_STORAGE )
|
||||
{
|
||||
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.strftime( "%y/%m/%d/%H/%M/%S", localtime($event->{Time}) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$event_path = ZM_PATH_WEB.'/'.ZM_DIR_EVENTS.'/'.$event->{MonitorId}.'/'.$event->{Id};
|
||||
}
|
||||
my $event_path = getEventPath( $event );
|
||||
chdir( $event_path );
|
||||
( my $video_name = $event->{Name} ) =~ s/\s/_/g;
|
||||
|
||||
|
||||
Reference in new issue
Block a user