Thursday, March 20, 2008

mind soothing audio clip downloader

i was searching for some mind soothing audio tracks. and came across a web site with an embedded player. the experience was not that good as the player pauses few times during a track to buffer the clip.

the result was this, a small php script to fetch the tracks to my server ;)


$i=1;
while($i < 13){
$feed = fopen('http://www.freesoothingmusic.com/category_playlist.php?cat_id=' . $i, 'r');
$contents = stream_get_contents($feed);
$dom = new DOMDocument;
@$dom->loadXML($contents);
$xml = @simplexml_import_dom($dom);
fclose($feed);
$trackCount = sizeof($xml->trackList->track);
for($j=0; $j < $trackCount; $j++) {
$fileLocation = $xml->trackList->track[$j]->location;
echo exec('wget ' . $fileLocation);
}
$i++;
}

0 comments: