introduce files, has_capture_jpegs and has_analyse_jpegs functions to use in zmaudit. Improve delete debugging output
This commit is contained in:
parent
b43093234f
commit
35d3a7d4fa
|
@ -370,7 +370,7 @@ sub delete {
|
|||
|
||||
if ( $$event{Id} ) {
|
||||
# Need to have an event Id if we are to delete from the db.
|
||||
Info("Deleting event $event->{Id} from Monitor $event->{MonitorId} StartTime:$event->{StartTime}");
|
||||
Info("Deleting event $event->{Id} from Monitor $event->{MonitorId} StartTime:$event->{StartTime} from ".$event->Path());
|
||||
$ZoneMinder::Database::dbh->ping();
|
||||
|
||||
$ZoneMinder::Database::dbh->begin_work();
|
||||
|
@ -800,6 +800,33 @@ sub recover_timestamps {
|
|||
}
|
||||
}
|
||||
|
||||
sub files {
|
||||
my $self = shift;
|
||||
|
||||
if ( ! $$self{files} ) {
|
||||
if ( ! opendir(DIR, $self->Path() ) ) {
|
||||
Error("Can't open directory '$$self{Path}': $!");
|
||||
return;
|
||||
}
|
||||
@{$$self{files}} = readdir(DIR);
|
||||
Debug('Have ' . @{$$self{files}} . " files in $$self{Path}");
|
||||
closedir(DIR);
|
||||
}
|
||||
return @{$$self{files}};
|
||||
}
|
||||
|
||||
sub has_capture_jpegs {
|
||||
@{$_[0]{capture_jpegs}} = grep(/^\d+\-capture\.jpg$/, $_[0]->files());
|
||||
Debug("have " . @{$_[0]{capture_jpegs}} . " capture jpegs");
|
||||
return @{$_[0]{capture_jpegs}} ? 1 : 0;
|
||||
}
|
||||
|
||||
sub has_analyse_jpegs {
|
||||
@{$_[0]{analyse_jpegs}} = grep(/^\d+\-analyse\.jpg$/, $_[0]->files());
|
||||
Debug("have " . @{$_[0]{analyse_jpegs}} . " analyse jpegs");
|
||||
return @{$_[0]{analyse_jpegs}} ? 1 : 0;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
|
Loading…
Reference in New Issue