whitespace mostly.
This commit is contained in:
parent
3a00656c3f
commit
25b66e9629
|
@ -94,15 +94,6 @@ my $size = '';
|
|||
my $overwrite = 0;
|
||||
my $version = 0;
|
||||
|
||||
my @formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} );
|
||||
for ( my $i = 0; $i < @formats; $i++ )
|
||||
{
|
||||
if ( $i =~ /^(.+)\*$/ )
|
||||
{
|
||||
$format = $formats[$i] = $1;
|
||||
}
|
||||
}
|
||||
|
||||
GetOptions(
|
||||
'concat|c:s' =>\$concat_name,
|
||||
'event|e=i' =>\$event_id,
|
||||
|
@ -122,42 +113,42 @@ if ( $version ) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
if ( !( $filter_id or $filter_name or $event_id ) || $event_id < 0 )
|
||||
{
|
||||
if ( !( $filter_id or $filter_name or $event_id ) || ($event_id and ( $event_id < 0 ) ) ) {
|
||||
print( STDERR "Please give a valid event id or filter name\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
||||
if ( ! $Config{ZM_OPT_FFMPEG} )
|
||||
{
|
||||
if ( ! $Config{ZM_OPT_FFMPEG} ) {
|
||||
print( STDERR "Mpeg encoding is not currently enabled\n" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ( !$rate && !$fps )
|
||||
{
|
||||
my @formats = split( /\s+/, $Config{ZM_FFMPEG_FORMATS} );
|
||||
for ( my $i = 0; $i < @formats; $i++ ) {
|
||||
if ( $i =~ /^(.+)\*$/ ) {
|
||||
$format = $formats[$i] = $1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$rate && !$fps ) {
|
||||
$rate = 1;
|
||||
}
|
||||
|
||||
if ( !$scale && !$size )
|
||||
{
|
||||
if ( !$scale && !$size ) {
|
||||
$scale = 1;
|
||||
}
|
||||
|
||||
if ( $rate && ($rate < 0.25 || $rate > 100) )
|
||||
{
|
||||
if ( $rate && ($rate < 0.25 || $rate > 100) ) {
|
||||
print( STDERR "Rate is out of range, 0.25 >= rate <= 100\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
||||
if ( $scale && ($scale < 0.25 || $scale > 4) )
|
||||
{
|
||||
if ( $scale && ($scale < 0.25 || $scale > 4) ) {
|
||||
print( STDERR "Scale is out of range, 0.25 >= scale <= 4\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
||||
if ( $fps && ($fps > 30) )
|
||||
{
|
||||
if ( $fps && ($fps > 30) ) {
|
||||
print( STDERR "FPS is out of range, <= 30\n" );
|
||||
pod2usage(-exitstatus => -1);
|
||||
}
|
||||
|
@ -192,8 +183,14 @@ if ( $event_id ) {
|
|||
Fatal("Filter $filter_name $filter_id not found.");
|
||||
}
|
||||
@event_ids = map { $_->{Id} } $Filter->Execute();
|
||||
Fatal( "No events found for $filter_name") if ! @event_ids;
|
||||
if ( ! @event_ids ) {
|
||||
Fatal( "No events found for $filter_name")
|
||||
} else {
|
||||
Debug(@event_ids . " events found for $filter_name");
|
||||
}
|
||||
$concat_name = $filter_name if $concat_name eq '';
|
||||
} else {
|
||||
Warning("Nothing to do");
|
||||
}
|
||||
|
||||
my $sql = " SELECT max(F.Delta)-min(F.Delta) as FullLength,
|
||||
|
@ -207,13 +204,11 @@ my $sql = " SELECT max(F.Delta)-min(F.Delta) as FullLength,
|
|||
INNER JOIN Events as E on F.EventId = E.Id
|
||||
INNER JOIN Monitors as M on E.MonitorId = M.Id
|
||||
WHERE EventId = ?
|
||||
GROUP BY F.EventId"
|
||||
;
|
||||
GROUP BY F.EventId";
|
||||
my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() );
|
||||
|
||||
my @video_files;
|
||||
foreach my $event_id ( @event_ids ) {
|
||||
|
||||
my $res = $sth->execute( $event_id )
|
||||
or Fatal( "Can't execute: ".$sth->errstr() );
|
||||
my $event = $sth->fetchrow_hashref();
|
||||
|
@ -223,6 +218,8 @@ foreach my $event_id ( @event_ids ) {
|
|||
if ( $video_file ) {
|
||||
push @video_files, $video_file;
|
||||
print( STDOUT $video_file."\n" );
|
||||
} else {
|
||||
Warning("No video file generated for event $event_id");
|
||||
}
|
||||
} # end foreach event_id
|
||||
|
||||
|
@ -249,11 +246,12 @@ if ( $concat_name ) {
|
|||
my $status = $? >> 8;
|
||||
|
||||
unlink $concat_list_file;
|
||||
if ( $status )
|
||||
{
|
||||
if ( $status ) {
|
||||
Error( "Unable to generate video, check /ffmpeg.log for details");
|
||||
exit(-1);
|
||||
}
|
||||
print( STDOUT $video_file."\n" );
|
||||
}
|
||||
exit( 0 );
|
||||
|
||||
__END__
|
||||
|
|
Loading…
Reference in New Issue