--- a/generateHourlys.php +++ b/generateHourlys.php @@ -6,22 +6,30 @@ 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'; + $cmd = "/usr/local/bin/ffmpeg -filter_complex concat=n=".count($filenames).":v=0:a=1 -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."
\n"; if ($returncode != 10) { //print_r($output); //die(); + } else { + /* insert + "filename" text NOT NULL, + "files" text ARRAY NOT NULL, + "datetime" timestamp NOT NULL + */ + // delete wav files? can we link to times in a compilation? } + } } $sth = $conn->prepare("select tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename order by call_timestamp), ',') filenames from recordings group by tgid, ahour, aday order by aday DESC, ahour, tgid;"); - +// TODO use tgid categories instead, tgid too specific $sth->execute(); $hourlies = $sth->fetchAll(PDO::FETCH_ASSOC); foreach($hourlies as $hourly) { - //processHourly($hourly); + processHourly($hourly); } $sth = $conn->prepare("select 'hour' as tgid, extract(hour from call_timestamp) ahour, date_trunc('day', call_timestamp) aday, count(filename), array_to_string(array_agg(filename order by call_timestamp), ',') filenames from recordings group by ahour, aday order by aday DESC, ahour;"); @@ -31,3 +39,6 @@ processHourly($hourly); } + +// delete uninteresting compilations +