Automatically generate playlist with php
<p>I generate a playlist with following script:</p>

<pre><code>   &lt;?php 
$dir        = './music';
$url        = 'music';

header('Content-type: text/xml');
echo '&lt;?xml version="1.0" encoding="utf-8"?&gt;' . "\n";
echo '&lt;playlist&gt;';
if (is_dir($dir)) {
    $dp = opendir($dir);
    while (false !== ($file = readdir($dp))){       
        if ('mp3'==strtolower(substr($file, -3))) {                     
            printf('&lt;sound src="%s/%s" stream="true" soundbuffer="8"&gt;%s&lt;/sound&gt;', $url, $file, str_replace('_', ' ', substr($file, 0, -4)));
            echo "\n";
        }        
    }
    closedir($dp);
}
echo '&lt;/playlist&gt;';
</code></pre>

<p><strong>How do I get the artist and length from each mp3 file?</strong></p>

<p>Thanks in advance</p>
