Browse Source

changed to convert to mp3 instead of ogg due to formatting

master
Sean Clarke 7 months ago
parent
commit
a28fe6dc1e
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      flac-to-mp3.php

+ 17
- 0
flac-to-mp3.php View File

@@ -0,0 +1,17 @@
<?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 . '"');
}
?>

Loading…
Cancel
Save