Scan folder for mp3s and play?
Will soundmanager scan a folder for 'mp3' files and queue them automatically?
I will be frequently adding/changing my mp3s and dont want to have to keep editing the source...
I will be frequently adding/changing my mp3s and dont want to have to keep editing the source...
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
Create a customer community for your own organization
Plans starting at $19/month
-
Inappropriate?Client side apps don't generally have access to view folder contents. You CAN enable this in apache I believe, but it would be much much easier to make a server-side script to compile a list of available songs and send that to the client.
Don't have an example on me, but I know that the php filesystem objects certainly allow that kind of action. Just about any server-side scripts do. -
Inappropriate?Yep, what bum51 said. I actually include a bit of example PHP script in one of the demos, which does just that sort of thing - loop through a directory, and write out links to the MP3 files.
General disclaimer: I'm not a PHP expert, this may be inefficient or not terribly secure, etc.
<?php
// print out MP3s in a given directory
// format:
// <li><a href="/my/music/artist - title.mp3">artist - title</a></li>
function listMP3s($path) {
$dir = $_SERVER['DOCUMENT_ROOT'].$path;
$dirlength = strlen($dir);
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
// print "filename: $filename<br />";
if (stristr($filename,'.mp3')) $files[] = $path."/".basename($filename);
if ($filename != "." && $filename != ".." && is_dir($dir."/".$filename)) listMP3s($path."/".$filename); // recurse through subdirectories
// print ("is dir: ".(($filename != "." && $filename != ".." && is_dir($dir."/".$filename))?"Yes":"No")."<br />");
}
rsort($files);
for ($i=0; $i<sizeof($files); $i++) {
print " <li><a href=\"".dirname($files[$i])."/".rawurlencode(basename($files[$i]))."\">".basename($files[$i])."</a></li>\n";
}
}
listMP3s('/my/music');
?>
The company says
this answers the question
Loading Profile...




EMPLOYEE