i heard thread wrote one of these already in php (maybe?) but i didn't find that out until i had completed this:
the mpd->html-playlist shell script! all it needs to run is mpd, mpc, and sed.
the script (playlist.sh):
#!/bin/sh
rm playlist.html
touch playlist.html
echo -en "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n" >> playlist.html
echo -en "<html>\n<head>\n\t<title>playlist</title>\n\t<style type=\"text/css\">\n\t\t@import url('playlist.css');\n\t</style>\n</head>\n<body>\n" >> playlist.html
echo -en "<h1>mpd playlist</h1>\n<table border=\"0\">\n" >> playlist.html
echo -en "\t<tr>\n\t\t<th class=\"a\">#</th>\n\t\t<th class=\"b\">artist</th>\n\t\t<th class=\"c\">album</th>\n\t\t<th class=\"d\">track</th>\n\t\t<th class=\"e\">title</th>\n\t\t<th class=\"f\">time</th>\n\t</tr>\n" >> playlist.html
mpc --format "[[<td class=\"b\">[%artist%]</td>\n\t\t<td class=\"c\">[%album%]</td>\n\t\t<td class=\"d\">[%track%]</td>\n\t\t<td class=\"e\">[%title%]</td>]|[<td class=\"g\" colspan=\"4\">[%file%]</td>]]\n\t\t<td class=\"f\">[%time%]</td>\n\t</tr>" playlist | sed -e "s/^#\([0-9]\+\)) /\t<tr>\n\t\t<td class=\"a\">\1<\/td>\n\t\t/g" | sed -e "s/\\\n/\n/g" | sed -e "s/\\\t/\t/g" | sed -e "s/&/&/g" >> playlist.html
echo -en "</table>\n</body>\n</html>\n" >> playlist.html
my sample stylesheet file to use with the playlist (playlist.css):
body {
font : 0.8em Verdana, sans-serif;
color : #111;
background : #EEE;
margin : 1em;
}
h1 {
font : bold 2em Verdana, sans-serif;
}
table {
border : 1px solid black;
}
td {
border : 1px solid black;
padding : 0.2em 1em 0.2em 1em;
}
td.a, td.d, td.f {
text-align : right;
background: #DDD;
}
td.g {
text-align : center;
background: #CCC;
}
visit
http://machbox.ath.cx/playlist.html for a sample output. it even validates, that is depending on your filename and id3 content.. invalid unicode characters get balked at.