Is it possible to automaticly ...Is it possible to automaticly generate playlists by listing all the reading the directory or a folder i set?
I think there is, but theres a few extra things I want added to it.
Can I make it display the latest tracks added at the top?
All my tracks end in [mysite.com].mp3
e.g. Some track - Some artist [mysite.com].mp3
Is it possible to take that bit out? So it only Some track - Some artist

This playlist generator will sort your files by date with the newest first.
If you don't want some of the elements, such as <creator> just comment out (add 2 forward slashes to the line) or delete the line. Example - this will remove the creator element from the playlist:
// echo " <creator>" . $creator . "</creator>\n";To remove [mysite.com] from the Title, increase the 4 in this code to whatever value you need to remove all of [mysite.com]. Right now it's set to 4 to remove the extension .mp3.
$title = substr($key, 0, strlen($key) - 4);playlistlphp
<?php/*
* This is a sample file that reads through a directory, filters the mp3/jpg/flv
* files and builds a playlist from it. After looking through this file, you'll
* probably 'get the idea' and'll be able to setup your own directory.
*
*/
// set this to a creator name
$creator = "Myself";
// search for mp3 files. set this to '.flv' or '.jpg' for the other scripts
$filter = ".mp3";
// path to the directory you want to scan
// "./" = current directory
$directory = "./";
// URL to files
$url = "http://www.somesite.com";
/////////////////////////// no user configuration variables below this \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// read through the directory and filter files to an array
@$d = dir($directory);
if ($d)
{
while($entry = $d->read())
{
$ps = strpos(strtolower($entry), $filter);
if (!($ps === false))
{
$items[$entry]['mtime'] = filemtime($entry);
}
}
$d->close();
arsort($items);
}
// the playlist is built in an xspf format
// first, we'll add an xml header and the opening tags...
header("content-type:text/xml;charset=utf-8");
echo "<?xml version='1.0' encoding='utf-8'?>\n";
echo "<playlist version='1' xmlns='http://xspf.org/ns/0/'>\n";
echo " <title>Sample PHP Generated Playlist</title>\n";
echo " <info>" . $url . "</info>\n";
echo " <trackList>\n";
// ...then we loop through the array...
foreach($items as $key => $value)
{
$title = substr($key, 0, strlen($key) - 4);
echo " <track>\n";
echo " <creator>" . $creator . "</creator>\n";
echo " <title>" . $title . "</title>\n";
echo " <location>" . $url . '/' . $key . "</location>\n";
echo " <info>" . $url . "</info>\n";
echo " </track>\n";
}
// ...and last we add the closing tags
echo " </trackList>\n";
echo "</playlist>\n";
/*
* That's it! You can feed this playlist to the SWF by setting this as it's 'file'
* parameter in your HTML page.
*/
?>