You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
521 B
17 lines
521 B
<?php
|
|
$flacs = shell_exec('find "$(pwd)" -type f -name "*.flac"');
|
|
$flacs_ex = preg_split("/\\r\\n|\\r|\\n/", $flacs);
|
|
$flacs_total = sizeof($flacs_ex);
|
|
$playlist = 'playlist.txt';
|
|
|
|
for($i = 0; $i < $flacs_total - 1; $i++){
|
|
|
|
$flac = $flacs_ex[$i];
|
|
$mp3 = str_replace('.flac', '.mp3', $flac);
|
|
|
|
# Generating the list
|
|
file_put_contents($playlist, $mp3 . PHP_EOL, FILE_APPEND | LOCK_EX);
|
|
# The conversion command
|
|
shell_exec('flac -cd "' . $flac . '" | lame -b 320 - "' . $mp3 . '"');
|
|
}
|
|
?>
|