-
Notifications
You must be signed in to change notification settings - Fork 4
/
test-dep.php
60 lines (48 loc) · 1.32 KB
/
test-dep.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
$isCLI = (php_sapi_name() == 'cli');
function getVersion($cmd,$search) {
exec("command -v $cmd 2>&1",$out,$code);
if ($code == 0) {
exec("$cmd --version 2>&1",$version);
foreach ($version as $line) {
if (strpos($line,$search) !== false) {
preg_match("/\d+\.\d+\.\d+/",$line,$match);
return $match[0];
}
}
}
return false;
}
$soundstretch_version = getVersion("soundstretch","SoundStretch");
$sox_version = getVersion("sox","SoX");
$mpg123_version = getVersion("mpg123","mpg123");
$ffmpeg_version = getVersion("ffmpeg","version");
echo "SoundTouch: \t";
if ($soundstretch_version !== false) {
echo "[PASS] detected SoundStretch ".$soundstretch_version;
} else {
echo "[FAIL] can't find a suitable SoundStretch";
}
echo ($isCLI ? "\n" : "<br>");
echo "SoX: \t";
if ($sox_version !== false) {
echo "[PASS] detected SoX ".$sox_version;
} else {
echo "[FAIL] can't find a suitable SoX";
}
echo ($isCLI ? "\n" : "<br>");
echo "mpg123: \t";
if ($mpg123_version !== false) {
echo "[PASS] detected mpg123 ".$mpg123_version;
} else {
echo "[FAIL] can't find a suitable mpg123";
}
echo ($isCLI ? "\n" : "<br>");
echo "ffmpeg: \t";
if ($ffmpeg_version !== false) {
echo "[PASS] detected ffmpeg ".$ffmpeg_version;
} else {
echo "[FAIL] can't find a suitable ffmpeg";
}
echo ($isCLI ? "\n" : "<br>");
?>