Browse Source

initial commit, filenames created and loop created

master
Sean Clarke 2 years ago
commit
561fa44029
  1. 5
      README.md
  2. 13
      mp3-to-ogg.php

5
README.md

@ -0,0 +1,5 @@
# mp3-to-ogg
This is a basic PHP script that can convert an entire directory (with all sub directories) of mp3s to ogg files.
[Buy me a ☕ or ☕☕](https://www.buymeacoffee.com/seanland)

13
mp3-to-ogg.php

@ -0,0 +1,13 @@
<?php
$mp3s = shell_exec('find "$(pwd)" -type f -name "*.mp3"');
$mp3s_ex = preg_split("/\\r\\n|\\r|\\n/", $mp3s);
$mp3s_total = sizeof($mp3s_ex);
for($i = 0; $i < $mp3s_total; $i++){
// echo $mp3s_ex[$i] . PHP_EOL;
$mp3 = $mp3s_ex[$i];
$ogg = str_replace('.mp3', '.ogg', $mp3);
echo $ogg . PHP_EOL;
}
?>