Browse Source

initial commit, filenames created and loop created

master
Sean Clarke 10 months ago
commit
561fa44029
2 changed files with 18 additions and 0 deletions
  1. +5
    -0
      README.md
  2. +13
    -0
      mp3-to-ogg.php

+ 5
- 0
README.md View File

@@ -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
- 0
mp3-to-ogg.php View File

@@ -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;
}
?>