Created
May 4, 2020 18:14
-
-
Save ibnux/9a2d451d2390a66cb8533f9b498df939 to your computer and use it in GitHub Desktop.
convert KeyGen Music Pack on mac using VLC command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// php -f convertKeyGenMusic.php | |
$path = "KEYGENMUSiC/"; | |
$command = '/Applications/VLC.app/Contents/MacOS/VLC -I dummy -vvv --sout \ | |
"#transcode{acodec=MP3,ab=128}:std{access=file,mux=wav,dst="/Users/ibnux/Desktop/KeyGenMusic_MusicPack_2020-03-full/MUSICKEYGEN/[DEST]"}" \ | |
"/Users/ibnux/Desktop/KeyGenMusic_MusicPack_2020-03-full/[SOURCE]" vlc://quit'; | |
scanDirectory($path); | |
function scanDirectory($path){ | |
global $command; | |
$folder = scandir($path); | |
foreach($folder as $file){ | |
if(!in_array($file,['.','..','DS_Store'])){ | |
if(is_dir($path.$file)){ | |
scanDirectory($path.$file."/"); | |
}else{ | |
echo exec(str_replace('[SOURCE]',$path.$file,str_replace('[DEST]',str_replace('_-_','-',str_replace(' ','_',stripText($file.".mp3"))),$command))); | |
//echo str_replace('[SOURCE]',$path.$file,str_replace('[DEST]',str_replace('_-_','-',str_replace(' ','_',stripText($file.".mp3"))),$command))."\n"; | |
} | |
} | |
} | |
} | |
function stripText($text) { | |
return preg_replace("[^A-Za-z0-9 ]", "", $text ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment