version 1.1.1.1, 2006/03/02 23:20:47 |
version 1.4, 2007/02/08 23:03:15 |
|
|
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
|
# $RedRiver: showfiles.pl,v 1.3 2007/02/08 20:04:03 andrew Exp $ |
######################################################################## |
######################################################################## |
# GenerateMP3HTML.pl *** Generates the HTML files for the playlist. |
# GenerateMP3HTML.pl *** Generates the HTML files for the playlist. |
# |
# |
|
|
#my qw/ @mp3s @dirs /; |
#my qw/ @mp3s @dirs /; |
|
|
my $basedir = '/home/mp3/Sorted'; |
my $basedir = '/home/mp3/Sorted'; |
my $subdir = $ENV{'QUERY_STRING'}; |
|
my $addurl = 'addmp3playlist.pl'; |
my $addurl = 'addmp3playlist.pl'; |
|
|
####################################################################### |
####################################################################### |
# *** MAIN *** |
# *** MAIN *** |
####################################################################### |
####################################################################### |
|
|
|
my ($prefix, $subdir) = split /\&/, $ENV{'QUERY_STRING'}; |
if ($subdir) { |
if ($subdir) { |
$subdir =~ s/%(..)/pack("c",hex($1))/ge; |
$subdir =~ s/%(..)/pack("c",hex($1))/ge; |
} else { |
} else { |
$subdir =''; |
$subdir =''; |
} |
} |
|
|
|
if ($prefix) { |
|
$prefix =~ s/%(..)/pack("c",hex($1))/ge; |
|
} else { |
|
$prefix =''; |
|
} |
|
|
my @dirs = GetDirListing("$basedir/$subdir"); |
my @dirs = GetDirListing("$basedir/$subdir"); |
my @mp3s = GetMP3Listing("$basedir/$subdir"); |
my @mp3s = GetMP3Listing("$basedir/$subdir"); |
|
|
|
|
if ($subdir) { |
if ($subdir) { |
print "<h3>"; |
print "<h3>"; |
SplitDir($subdir); |
SplitDir($subdir); |
print " - <font size=\"-2\"><a href=\"" . "showall.pl" . "\?" . EncodeURL("$subdir") . "\">All</a></font>"; |
print " - <font size=\"-2\"><a href=\"" . "showall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir") . "\">Show</a></font>"; |
print " - <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL("$subdir") . "\">Add</a></font><br>"; |
print " - <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir") . "\">Play</a></font>"; |
|
print " - <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir") . '&' . EncodeURL('fulllist.lst') . "\">Approve</a></font>" if $prefix; |
|
print "<br>\n"; |
print "</h3>\n"; |
print "</h3>\n"; |
print "<hr>\n"; |
print "<hr>\n"; |
} |
} |
|
|
if (@dirs) { |
if (@dirs) { |
foreach my $dir (@dirs) { |
foreach my $dir (@dirs) { |
print "<a href=\"" . MyName() . "\?" . EncodeURL("$subdir/$dir") . "\">$dir</a> "; |
print "<a href=\"" . MyName() . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$dir") . "\">$dir</a> "; |
print "- <font size=\"-2\"><a href=\"" . "showall.pl" . "\?" . EncodeURL("$subdir/$dir") . "\">All</a></font>"; |
print "- <font size=\"-2\"><a href=\"" . "showall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$dir") . "\">Show</a></font>"; |
print "- <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL("$subdir/$dir") . "\">Add</a></font><br>"; |
print "- <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$dir") . "\">Play</a></font>"; |
|
print "- <font size=\"-2\"><a href=\"" . "addall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$dir") . '&' . EncodeURL('fulllist.lst') . "\">Approve</a></font>" if $prefix; |
|
print "<br>\n"; |
} |
} |
} |
} |
|
|
|
|
} |
} |
|
|
$songtitle =~ s/\.(mp3|ogg)$//i; |
$songtitle =~ s/\.(mp3|ogg)$//i; |
print "<a href=\"$addurl\?" . EncodeURL("$subdir/$mp3") . "\" target=\"bottom\">$songtitle</a></li>\n"; |
print "<a href=\"$addurl\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$mp3") . "\" target=\"bottom\">$songtitle</a>"; |
|
print " - <font size=\"-2\"><a href=\"$addurl\?" . EncodeURL($prefix) . '&' . EncodeURL("$subdir/$mp3") . '&' . EncodeURL('fulllist.lst') . "\" target=\"bottom\">Approve</a></font>" if $prefix; |
|
print "</li>\n"; |
} |
} |
print "</ul>\n"; |
print "</ul>\n"; |
} |
} |
|
|
for ($j=0;$j<=$i;$j++) { |
for ($j=0;$j<=$i;$j++) { |
$url = "$url/$filename[$j]"; |
$url = "$url/$filename[$j]"; |
} |
} |
print "/<a href=\"showfiles.pl\?" . EncodeURL($url) . "\">$filename[$i]</a>"; |
print "/<a href=\"showfiles.pl\?" . EncodeURL($prefix) . '&' . EncodeURL($url) . "\">$filename[$i]</a>"; |
|
|
} |
} |
} else { |
} else { |