1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <?php
$monRep = "../morceaux";
if (is_dir($monRep)) {
if ($dir = opendir($monRep)) {
while (($file = readdir($dir)) !== false) {
$dirfile = "$monRep/$file";
if (stristr($dirfile, ".ogg") && is_readable($dirfile)) {
$fp = fopen($monRep."/".$file, "rb");
$header = fread($fp, 512);
$tagB = 'Xiph.Org libVorbis I';
$tagE = 'BCV';
$debTag = strpos( $header, $tagB ) + strlen( $tagB );
$finTag = strpos( $header, $tagE );
$lesTags = substr($header, $debTag, $finTag - $debTag);
$lesTags = preg_replace("/\\x0|[\x01-\x1f]|vorbis./U"," ", $lesTags);
$lesTags = preg_replace('/\s\s+/', ':', $lesTags);
list($ver, $titre, $album, $artiste, $date, $genre) = split(':', $lesTags);
echo "$ver - $titre - $album - $date - $genre .";
fclose($fp);
}
}
}
closedir($dir);
?>
} |
Partager