version 1.1.1.1, 2006/03/02 23:20:48 |
version 1.3, 2007/02/08 20:04:03 |
|
|
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
|
# $RedRiver: showplaylist.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $ |
######################################################################## |
######################################################################## |
# ShowPlaylist.pl *** Displays our current playlist on a web page |
# ShowPlaylist.pl *** Displays our current playlist on a web page |
# |
# |
|
|
|
|
my $args = shift; |
my $args = shift; |
|
|
my ($listfile,$add); |
my $exe = 'removemp3playlist.pl'; |
if ($args) { |
####################################################################### |
($listfile,$add) = split /\\&/, $args; |
# *** 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'; |
$listfile ||= 'playlist.lst'; |
unless ($listfile eq 'playlist.lst') { |
my $list = '/var/www/mp3/playlist/' . $prefix . $listfile; |
$exe = 'addmp3playlist.pl'; |
|
} else { |
if ($listfile eq 'playlist.lst' || $listfile eq 'fulllist.lst') { |
$add = undef; |
$add = undef; |
|
} else { |
|
$exe = 'addmp3playlist.pl'; |
} |
} |
|
|
####################################################################### |
|
# *** MAIN *** |
|
####################################################################### |
|
|
|
|
|
my @playlist = get_playlist($list); |
my @playlist = get_playlist($list); |
|
|
print "Content-Type: text/html\n\n"; |
print "Content-Type: text/html\n\n"; |
|
|
if ($add) { |
if ($add) { |
AddSong($filename); |
AddSong($filename); |
} else { |
} else { |
print "\t<li><a href=\"$exe\?" . EncodeURL($filename) . "\" target=\"bottom\">$filename</a></li>\n"; |
print "\t<li><a href=\"$exe\?" . EncodeURL($prefix) . '&' . EncodeURL($filename) . '&' . EncodeURL($listfile) . "\" target=\"bottom\">$filename</a></li>\n"; |
} |
} |
$counter++; |
$counter++; |
} |
} |
|
|
$filename =~ s/%(..)/pack("c",hex($1))/ge; |
$filename =~ s/%(..)/pack("c",hex($1))/ge; |
|
|
if ($filename) { |
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"; |
print PLAYLIST "$filename\n"; |
close PLAYLIST or bail("unable to close PLAYLIST: $!"); |
close PLAYLIST or bail("unable to close PLAYLIST: $!"); |
print "Added $filename<br>\n"; |
print "Added $filename<br>\n"; |