Created
May 18, 2010 00:10
-
-
Save robesris/404416 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($handle = opendir('.')) { | |
while (false !== ($file = readdir($handle))) { | |
if ($file != "." && $file != "..") { | |
if (is_dir($file)) { | |
echo "<h1>$file</h1>"; | |
$album = opendir($file); | |
while (false !== ($song = readdir($album))) { | |
$info = pathinfo($song); | |
if ($info['extension'] == "mp3" || $info['extension'] == "ogg") { | |
echo "<div>$song<audio controls='controls' src=\"$file/$song\">"; | |
echo "</audio></div>"; | |
} | |
} | |
} | |
} | |
} | |
closedir($handle); | |
} | |
?> |
Took out one line that had an unused variable assignment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Really simple php script for listing directories of mp3s or ogg files as albums and displaying them with audio controls using HTML5 audio tag. Only Chrome seems to have native mp3 support right now.