-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessor.php
More file actions
30 lines (24 loc) · 957 Bytes
/
processor.php
File metadata and controls
30 lines (24 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
set_time_limit(0);
include "storage.php";
$filename = $_POST['filename'];
$filename_part = explode(".", $filename)[0];
// Converting audio to flac using ffmpeg binary
$cmd = "php audio-converter.php audio.".explode(".", $filename)[1];
exec($cmd, $out1);
if(strpos($out1[0], "yes") !== FALSE) // checking if conversion is successfull
{
if(uploadAudioCloud("audio.flac") == "yes") // uploading to cloud
{
$cmd = 'php speech.php transcribe gs://proverbial-cathode-5780/audio.flac --encoding FLAC --async';
exec($cmd, $out2);
$statement = "";
foreach ($out2 as $outputed) {
if(strpos($outputed, "[transcript]") !== FALSE)
{
$statement .= trim(str_replace("[transcript] => ", "", $outputed))."<br>";
}
}
echo $statement;
}
}