=================================================================== RCS file: /cvs/mp3/bin/showplaylist.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mp3/bin/showplaylist.pl 2006/08/12 01:14:53 1.2 +++ mp3/bin/showplaylist.pl 2007/02/08 20:04:03 1.3 @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# $RedRiver$ +# $RedRiver: showplaylist.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $ ######################################################################## # ShowPlaylist.pl *** Displays our current playlist on a web page # @@ -14,27 +14,41 @@ my $args = shift; -my ($listfile,$add); -if ($args) { - ($listfile,$add) = split /\\&/, $args; +my $exe = 'removemp3playlist.pl'; +####################################################################### +# *** MAIN *** +####################################################################### +my ($prefix, $listfile, $add) = split /\&/, $ENV{'QUERY_STRING'}; +if ($listfile) { + $listfile =~ s/%(..)/pack("c",hex($1))/ge; +} else { + $listfile =''; } -$listfile ||= 'playlist.lst'; +if ($add) { + $add =~ s/%(..)/pack("c",hex($1))/ge; +} else { + $add =''; +} -my $list = '/var/www/mp3/playlist/' . $listfile; +if ($prefix) { + $prefix =~ s/%(..)/pack("c",hex($1))/ge; +} else { + $prefix =''; +} -my $playlist = '/var/www/mp3/playlist/playlist.lst'; +my $playlist = '/var/www/mp3/playlist/' . $prefix . 'playlist.lst'; -my $exe = 'removemp3playlist.pl'; -unless ($listfile eq 'playlist.lst') { - $exe = 'addmp3playlist.pl'; -} else { +$listfile ||= 'playlist.lst'; +my $list = '/var/www/mp3/playlist/' . $prefix . $listfile; + +if ($listfile eq 'playlist.lst' || $listfile eq 'fulllist.lst') { $add = undef; +} else { + $exe = 'addmp3playlist.pl'; } -####################################################################### -# *** MAIN *** -####################################################################### + my @playlist = get_playlist($list); print "Content-Type: text/html\n\n"; @@ -71,7 +85,7 @@ if ($add) { AddSong($filename); } else { - print "\t
  • $filename
  • \n"; + print "\t
  • $filename
  • \n"; } $counter++; } @@ -169,7 +183,7 @@ $filename =~ s/%(..)/pack("c",hex($1))/ge; if ($filename) { - open PLAYLIST, ">>$playlist" or bail("unable to open PLAYLIST: $!"); + open PLAYLIST, ">>$prefix$playlist" or bail("unable to open PLAYLIST: $!"); print PLAYLIST "$filename\n"; close PLAYLIST or bail("unable to close PLAYLIST: $!"); print "Added $filename
    \n";