Playlist Generator
January 19th, 2010 - 23:30:42
My hard drive was formatted…
Damn.. all my mp3s were gone
So how do I listen to music, hmm.. I’d usually using AOL radio, but I can only listen to what aol playing based on available categories, so when I found my neighbor server, It shares mp3 files via web server. But I only have two hands.. not enough to copy all the mp3 links and paste them to my player.
So I created this, to generate playlist from web server contains mp3 files.
look like these


with this php code, you can generate playlist from all mp3s on this server
<?
$url="http://10.14.12.11/music/Barat/";
$depth=3;
$track_ar=Array();
function get_track($u,$d){
global $depth;
global $track_ar;
if($d>=1){
$s1=@file_get_contents($u);
$p=str_replace("\"","'",$s1);
$p1=explode("href='",$p);
foreach($p1 as $item){
$p2=explode("'",$item);
$head=substr($p2[0],0,1);
$tail=substr($p2[0],-1);
$tail2=substr($p2[0],-3);
if(strtolower($tail2)=="mp3"){
$track_ar[]=$p2[0];
echo $u.$p2[0]."\n";
}else if(($tail=="/")&&($head!="/")){
get_track($u.$p2[0],$d-1);
}
}
}
}
get_track($url,$depth);
?>

Then you can just save it as a .m3u file and open it with your favourite mp3 player like ITunes or winamp
Facebook Connect
Regular Comments