From c33b8a87804963601cb59737c4ba1c484aa70f62 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 5 May 2017 17:52:56 -0400 Subject: [PATCH 1/2] fix SQL query that gets the event --- scripts/zmvideo.pl.in | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/zmvideo.pl.in b/scripts/zmvideo.pl.in index dcb3633fb..17212bee2 100644 --- a/scripts/zmvideo.pl.in +++ b/scripts/zmvideo.pl.in @@ -203,19 +203,17 @@ if ( $event_id ) { $concat_name = $filter_name if $concat_name eq ''; } -my $sql = " SELECT max(F.Delta)-min(F.Delta) as FullLength, - E.*, - unix_timestamp(E.StartTime) as Time, +my $sql = " SELECT (SELECT max(Delta) FROM Frames WHERE EventId=Events.Id)-(SELECT min(Delta) FROM Frames WHERE EventId=Events.Id) as FullLength, + Events.*, + unix_timestamp(Events.StartTime) as Time, M.Name as MonitorName, M.Width as MonitorWidth, M.Height as MonitorHeight, M.Palette - FROM Frames as F - 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" - ; + FROM Events + INNER JOIN Monitors as M on Events.MonitorId = M.Id + WHERE Events.Id = ? + "; my $sth = $dbh->prepare_cached( $sql ) or Fatal( "Can't prepare '$sql': ".$dbh->errstr() ); Debug($sql); From e45316dcd10480d94b5b3fb48cf020f708196d18 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 5 May 2017 17:53:03 -0400 Subject: [PATCH 2/2] add debugging --- web/includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 0f0441d38..586e1829a 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1043,7 +1043,9 @@ function createVideo( $event, $format, $rate, $scale, $overwrite=false ) { $command .= " -s ".sprintf( "%.2f", ($scale/SCALE_BASE) ); if ( $overwrite ) $command .= " -o"; - $result = exec( escapeshellcmd( $command ), $output, $status ); + $command = escapeshellcmd( $command ); + $result = exec( $command, $output, $status ); +Debug("generating Video $command: result($result outptu:(".implode("\n", $output )." status($status"); return( $status?"":rtrim($result) ); }