[BACK]Return to addall.pl CVS log [TXT][DIR] Up to [local] / mp3 / bin

Diff for /mp3/bin/addall.pl between version 1.2 and 1.3

version 1.2, 2006/08/12 01:14:53 version 1.3, 2007/02/08 20:04:03
Line 1 
Line 1 
 #!/usr/bin/perl -w  #!/usr/bin/perl -w
 # $RedRiver$  # $RedRiver: addall.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $
 ########################################################################  ########################################################################
 # showall.pl *** Displays all MP3's in all subdirs  # showall.pl *** Displays all MP3's in all subdirs
 #  #
Line 13 
Line 13 
 #my qw/ %mp3s %dirs /;  #my qw/ %mp3s %dirs /;
   
 my $basedir = '/home/mp3/Sorted';  my $basedir = '/home/mp3/Sorted';
 my $subdir = $ENV{'QUERY_STRING'};  
 my $playlist = '/var/www/mp3/playlist/playlist.lst';  
   
 my $countdir = 0;  my $countdir = 0;
 my $countmp3 = 0;  my $countmp3 = 0;
Line 22 
Line 20 
 # *** MAIN ***  # *** MAIN ***
 #######################################################################  #######################################################################
   
 if ($subdir) {  my ($prefix, $subdir, $playlist) = split /\&/, $ENV{'QUERY_STRING'};
         $subdir =~ s/%(..)/pack("c",hex($1))/ge;  if ($subdir) {
           $subdir =~ s/%(..)/pack("c",hex($1))/ge;
 } else {  } else {
         $subdir ='';          $subdir ='';
 }  }
   if ($playlist) {
           $playlist =~ s/%(..)/pack("c",hex($1))/ge;
   } else {
           $playlist = 'playlist.lst';
   }
   
   if ($prefix) {
           $prefix =~ s/%(..)/pack("c",hex($1))/ge;
   } else {
           $prefix ='';
   }
   
   my $playlist = '/var/www/mp3/playlist/' . $prefix . $playlist;
 #$basedir = $basedir . "/" . $subdir;  #$basedir = $basedir . "/" . $subdir;
   
 print "Content-Type: text/html\n\n";  print "Content-Type: text/html\n\n";
Line 51 
Line 62 
 #       my $count;  #       my $count;
 #       my @sorted = sort { lc($dirs{$a}) cmp lc($dirs{$b}) } (keys %dirs);  #       my @sorted = sort { lc($dirs{$a}) cmp lc($dirs{$b}) } (keys %dirs);
 #       foreach my $dir (@sorted) {  #       foreach my $dir (@sorted) {
 #               print "<a href=\"showfiles.pl\?" . EncodeURL("$dir/$dirs{$dir}") . "\">$dirs{$dir}</a><br>";  #               print "<a href=\"showfiles.pl\?" . EncodeURL($prefix) . '&' . EncodeURL("$dir/$dirs{$dir}") . "\">$dirs{$dir}</a><br>";
 #               $count++;  #               $count++;
 #       }  #       }
 #       print "Total dirs displayed: $count<p>\n";  #       print "Total dirs displayed: $count<p>\n";
Line 63 
Line 74 
 #       my $count;  #       my $count;
 #       foreach my $mp3dir (sort keys %mp3s) {  #       foreach my $mp3dir (sort keys %mp3s) {
 #               foreach $mp3 (@{ $mp3s{$mp3dir} }) {  #               foreach $mp3 (@{ $mp3s{$mp3dir} }) {
 #                       print "\t<li>Song: <a href=\"$addurl\?" . EncodeURL("$mp3dir/$mp3") . "\" target=\"bottom\">$mp3</a></li>\n";  #                       print "\t<li>Song: <a href=\"$addurl\?" . EncodeURL($prefix) . '&' . EncodeURL("$mp3dir/$mp3") . "\" target=\"bottom\">$mp3</a></li>\n";
 #                       $count++;  #                       $count++;
 #               }  #               }
 #       }  #       }
Line 96 
Line 107 
         print "<ul>\n";          print "<ul>\n";
         foreach my $directory (@directories) {          foreach my $directory (@directories) {
 #               $dirs{"$DIR/$directory"} = $directory;  #               $dirs{"$DIR/$directory"} = $directory;
                 print "<li><a href=\"showfiles.pl\?" . EncodeURL("$DIR/$directory") . "\">$directory</a>";                  print "<li><a href=\"showfiles.pl\?" . EncodeURL($prefix) . '&' . EncodeURL("$DIR/$directory") . "\">$directory</a>";
                 print " - <font size=\"-1\"><a href=\"" . "showall.pl" . "\?" . EncodeURL("$DIR/$directory") . "\">All</a></font></li>";                  print " - <font size=\"-1\"><a href=\"" . "showall.pl" . "\?" . EncodeURL($prefix) . '&' . EncodeURL("$DIR/$directory") . "\">All</a></font></li>";
   
                 $countdir++;                  $countdir++;
                 my @curdir = GetDirListing("$DIR/$directory");                  my @curdir = GetDirListing("$DIR/$directory");
Line 105 
Line 116 
   
   
 #               push @dirs, @curdir;  #               push @dirs, @curdir;
 #               print "<a href=\"showfiles.pl\?" . EncodeURL("$DIR/$directory") . "\">$directory</a><br>";  #               print "<a href=\"showfiles.pl\?" . EncodeURL($prefix) . '&' . EncodeURL("$DIR/$directory") . "\">$directory</a><br>";
         }          }
         opendir DIR, "$basedir/$DIR" or bail("Unable to opendir $$!");          opendir DIR, "$basedir/$DIR" or bail("Unable to opendir $$!");
                 my @temp = grep /\.(mp3|ogg)$/i, readdir(DIR);                  my @temp = grep /\.(mp3|ogg)$/i, readdir(DIR);
 #               $mp3s{"$DIR/$directory"} = [ @temp ];  #               $mp3s{"$DIR/$directory"} = [ @temp ];
                 print "<ul>\n";                  print "<ul>\n";
                 foreach my $mp3 (@temp) {                  foreach my $mp3 (@temp) {
 #                       print "\t<li>Song: <a href=\"$addurl\?" . EncodeURL("$DIR/$mp3") . "\" target=\"bottom\">$mp3</a></li><br>\n";  #                       print "\t<li>Song: <a href=\"$addurl\?" . EncodeURL($prefix) . '&' . EncodeURL("$DIR/$mp3") . "\" target=\"bottom\">$mp3</a></li><br>\n";
                         print "\t<li>";                          print "\t<li>";
                         AddSong("$DIR/$mp3");                          AddSong("$DIR/$mp3");
                         print "</li>\n";                          print "</li>\n";
Line 184 
Line 195 
                         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 {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>