Hi I have just recently made a FLASH AS3 XML playlist player which works great apart from the part where I have to type all the XML out. I have had some help with someone to compile this code that works great, but I want to be able to save the XML to file and not just read of it. And to update itself if the number of .mp3s in the given folder increases.
require_once('getid3/getid3.php');
$dir = $_GET['folder'];
$xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmlBody .= "<XML>";
$getID3 = new getID3;
$DirectoryToScan = 'SOUNDS';
$dirHandle = opendir($dir);
$strIsNull = "not found";
$i = 0;
while (($file = readdir($dirHandle)) !== false) {
$FullFileName = realpath($dir.'/'.$file);
if ((substr($FullFileName, 0, 1) != '.') && is_file($FullFileName)) {
$i++;
set_time_limit(30);
$ThisFileInfo = $getID3->analyze($FullFileName);
getid3_lib::CopyTagsToComments($ThisFileInfo);
$xmlBody .= '<Song>';
$xmlBody .= '<songNum>' . $i . '</songNum>
<songURL>' .basename($ThisFileInfo['filenamepath']).'</songURL>
<songArtist>' .(!empty($ThisFileInfo['comments_html']['artist']) ? implode('<br>',$ThisFileInfo['comments_html']['artist']) : $strIsNull) .'</songArtist>
<songTitle>' .(!empty($ThisFileInfo['comments_html']['title']) ?implode('<br>', $ThisFileInfo['comments_html']['title']) : $strIsNull) . '</songTitle>
<songSize>' .round($ThisFileInfo['audio']['bitrate'] / 1000).' kbps </songSize>
<songDuration>' . $ThisFileInfo['playtime_string'].' </songDuration>';
$xmlBody .= '</Song>';
}
}
$xmlBody .= "</XML>";
header('Content-type: text/xml');
echo $xmlBody;