/ Published in: PHP
URL: http://www.gotoandlearnforum.com/memberlist.php?mode=viewprofile&u=954
I found this script out in space and think it's rad. Click on the URL to see this authors profile. The easiest way to use this script is to place it in the same directory as your mp3's then make a request to the php. The php will return an XML with the song Path, Title, and Author which is great for Flash.
Expand |
Embed | Plain Text
<?php $dir = 'directory_of_mp3_files'; $file_type = 'mp3'; $play_list = '<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\'?>'; $play_list .= "<playlist>"; // Open directory, read contents and add to file_list if correct file_type if ($file != '.' && $file != '..') { // if file has .mp3 extension if ($name_array[1] == $file_type) { $play_list .= '<song>'; $file = "$dir/$file"; $play_list .= '<file>' . $file . '</file>'; // if id3 tag is found... if ($tag == "TAG") { // if no id3 tag... } else { $play_list .= '<title>unknown title</title>'; $play_list .= '<artist>unknown artist</artist>'; } // close file $play_list .= '</song>'; } } } // close directory $play_list .= '</playlist>'; // echo the xml file echo "$play_list"; } } ?>
Comments
Subscribe to comments
You need to login to post a comment.

this is nice, but for those of you that want it recursive here is my own version
this is nice, but for those of you that want it recursive here is my own version