Old 6th January 2005, 01:34   #1
JayHawk
Junior Member
 
JayHawk's Avatar
 
Join Date: Oct 2002
Location: um, um.... Dam it I forgot again!
Posts: 32
Send a message via AIM to JayHawk
Generate HTML Playlist Plugin

Is there some way to edit the way that the html playlist is generated?
JayHawk is offline   Reply With Quote
Old 6th January 2005, 01:57   #2
billyvnilly
Forum King, M.D.
 
billyvnilly's Avatar
 
Join Date: Mar 2004
Location: Detroit burbs
Posts: 3,379
Send a message via ICQ to billyvnilly Send a message via AIM to billyvnilly
how so?

it spits out the generated html playlist based on your advanced title formatting (options > pref. > titles)... however you must reload playlist to get new titles working.
billyvnilly is offline   Reply With Quote
Old 6th January 2005, 02:03   #3
DrO
 
Join Date: Sep 2003
Posts: 27,873
or you intercept the command to do that action and output a html playlist yourself (and i've a part completed plugin which does that though only for modifying the colours at the moment)

-daz
DrO is offline   Reply With Quote
Old 6th January 2005, 03:19   #4
shaneh
Major Dude
 
Join Date: Jan 2004
Location: Brisbane, Australia
Posts: 1,193
You could use ActiveWinamp to output the file in whatever format you like. Just do:

output: "<HTML>"
for each song in playlist
output: song.ATFString("%title% by %artist%")
next
output: "</HTML>"

Look for some examples on writing to files.
shaneh is offline   Reply With Quote
Old 17th January 2005, 23:18   #5
JayHawk
Junior Member
 
JayHawk's Avatar
 
Join Date: Oct 2002
Location: um, um.... Dam it I forgot again!
Posts: 32
Send a message via AIM to JayHawk
I pretty much want to do what you're talking about DrO. I'd like to specify exactly what html is used when it spits out the file.
JayHawk is offline   Reply With Quote
Old 17th January 2005, 23:27   #6
DrO
 
Join Date: Sep 2003
Posts: 27,873
development got as far as imitating the existing html format and then using user-defined colours for the different parts of text, etc (along with an auto-updating preview in the preferences to see what it looks like). if i can find the time then i'll look into getting it public release ready (no promises though)

-daz
DrO is offline   Reply With Quote
Old 26th January 2005, 20:31   #7
n2jtx
Junior Member
 
Join Date: Feb 2004
Posts: 35
Send a message via AIM to n2jtx
I was rather happy with the pre-5.0 format of the HTML playlist and kept a copy around so that I could generate the playlists rather easily. Then one day it dawned on me that this really isn't a big coding deal so I threw together a Perl script to scan an M3U and generate an HTML file in a format similar to the Winamp HTML output.

FWIW, this is the script:

use MP3::Info;
use File::Basename;

if (!defined @ARGV[0])
{
print "Error: argument required\n";
exit;
}

@ARGV[1] = "Music" if (!defined @ARGV[1]);
$playlistTitle = @ARGV[1];
$margin = length($playlistTitle) * 24;

$dirname = dirname(@ARGV[0]);
$dirname .= "\\" if ($dirname);
open(M3U,@ARGV[0]) || die $!;
$totalLength = 0;
$entryCount = 0;
while(<M3U>)
{
chop;
next if (/^#EXT/);
$entryCount++;
$filename = $dirname . $_;
if (-r $filename)
{
my $info = get_mp3info($filename);
my $id3 = get_mp3tag($filename);
$length = int($info->{'SECS'});
$totalLength += $length;
$artist = $id3->{'ARTIST'};
$title = $id3->{'TITLE'};
$lengthString = sprintf("%d:%02d",$length / 60,$length % 60);
if (($title eq "") || ($artist eq ""))
{
push @data,"<tr><td colspan=2>(",$_,")<td>",$lengthString,"</tr>\n";
}
else
{
push @data,"<tr><td>",$artist,"<td>",$title,"<td>",$lengthString,"</tr>\n";
}
}
else
{
push @data,"<tr><td colspan=3>(Missing file: ${filename})</tr>\n";
}
print STDERR "Processed ",$entryCount," files...\r" if ($entryCount % 25 == 0);
#last if ($entryCount == 25);
}
close(M3U);
$average = ($totalLength / $entryCount);
$averageString = sprintf("%d:%02d\n",$average / 60,$average % 60);
$hours = int($totalLength / 3600);
$hourString = sprintf("<font face=\"Arial\" color=\"#FFBF00\">%d</font><font color=\"#409FFF\" face=\"Arial\"> hour%s </font>",
$hours,($hours == 1 ? "" : "s"));
$minutes = int(($totalLength % 3600) / 60);
$minuteString = sprintf("<font face=\"Arial\" color=\"#FFBF00\">%d</font><font color=\"#409FFF\" face=\"Arial\"> minute%s </font>",
$minutes,($minutes == 1 ? "" : "s"));
$seconds = int(($totalLength % 3600) % 60);
$secondString = sprintf("%d second%s",$seconds,($seconds == 1 ? "" : "s"));
$secondString = sprintf("<font face=\"Arial\" color=\"#FFBF00\">%d</font><font color=\"#409FFF\" face=\"Arial\"> second%s </font>",
$seconds,($seconds == 1 ? "" : "s"));
$totalString = "";
if ($hours > 0)
{
$totalString = $hourString;
}
$totalString .= $minuteString . $secondString;
print <<EOF;
<html>
<head>
<!-- Created by GenerateHTMLPlaylistTable.pl -->
<link rel="stylesheet" href="null">
<style TYPE="text/css">
<!--BODY { background: #000040; }
.para1 { margin-top: -42px; margin-left: ${margin}px; margin-right: 10px; font-family: "font2, Arial"; font-size: 30px; line-height: 35px; text-align: left; color: #E1E1E1; }
.para2 { margin-top: 15px; margin-left: 15px; margin-right: 50px; font-family: "font1, Arial Black"; font-size: 50px; line-height: 40px; text-align: left; color: #004080; }
-->
</style>
<title>Generated ${playlistTitle} PlayList</title>
</head>
<body BGCOLOR="#000080" topmargin="0" leftmargin="0" text="#FFFFFF">
<!--TOOLBAR_START--><!--TOOLBAR_EXEMPT-->
<div align="center">
<div CLASS="para2" align="center">
<p>${playlistTitle}</p></div><div CLASS="para1" align="center">
<p>playlist</p></div></div><hr align="left" width="90%" noshade size="1" color="#FFBF00"><div align="right">
<table border="0" cellspacing="0" cellpadding="0" width="98%"><tr><td><small><small><font face="Arial" color="#FFBF00">
${entryCount}</font><font color="#409FFF" face="Arial"> tracks in playlist, average track length: </font><font face="Arial" color="#FFBF00">${averageString}</font></small></small><br><small><small><font color="#409FFF" face="Arial">Playlist length: </font>${totalString}<BR>
</small></td></tr></table></div><font face="Arial" color="#FFFFFF"><p><div align="right"><table border="0" cellspacing="0" cellpadding="0" width="98%"><tr><td>
<table cellSpacing=0 cellPadding=0 style="PADDING-BOTTOM: 0px; PADDING-TOP: 2px; PADDING-RIGHT: 6px; PADDING-LEFT: 0px; FONT-SIZE: 8pt"><tbody>
<tr><th align=left>Artist<th align=left>Title<th align=left>Length</tr>
EOF
;

foreach $line (@data)
{
print $line;
}
print <<EOF;
</tbody></table></table></div>
</font><hr align="left" width="90%" noshade size="1" color="#FFBF00"></body></html>
EOF
;

print STDERR "Processed total of ",$entryCount," files.\n";
n2jtx is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump