--- a/generateHourlys.php +++ b/generateHourlys.php @@ -1,1 +1,24 @@ +prepare("select tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename), ',') filenames from recordings group by tgid, ahour, aday order by aday DESC, ahour, tgid;"); +$sth->execute(); +$hourlies = $sth->fetchAll(PDO::FETCH_ASSOC); +foreach($hourlies as $hourly) { + $filename = $hourly['tgid'].'-'.str_replace(' 00:00:00+1','',$hourly['aday']).'-'.$hourly['ahour'].'.3gp'; + + if(!file_exists("hourly/".$filename)) { + + $filenames = explode(",",$hourly['filenames']); + $cmd = "/usr/local/bin/ffmpeg -i data/".implode(" -i data/",$filenames)." -ar 8000 -ab 4.75k -ac 1 hourly/".$filename . ' 2>&1'; + //print_r($hourly); + exec ( $cmd,$output,$returncode ); + echo $cmd.'
'; + if ($returncode != 10) { + //print_r($output); + //die(); + } + } +} + +