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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 

17 lines
515 B

<?php
$mp3s = shell_exec('find "$(pwd)" -type f -name "*.mp3"');
$mp3s_ex = preg_split("/\\r\\n|\\r|\\n/", $mp3s);
$mp3s_total = sizeof($mp3s_ex);
$playlist = 'playlist.txt';
for($i = 0; $i < $mp3s_total - 1; $i++){
$mp3 = $mp3s_ex[$i];
$ogg = str_replace('.mp3', '.ogg', $mp3);
# Generating the list
file_put_contents($playlist, $ogg . PHP_EOL, FILE_APPEND | LOCK_EX);
# The conversion command
shell_exec('mpg321 "' . $mp3 . '" -w raw && oggenc raw -o "' . $ogg . '"');
}
?>