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

Diff for /mp3/bin/showplaylist.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: 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
 #  #
Line 14 
Line 14 
   
 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";
Line 71 
Line 85 
                 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++;
         }          }
Line 169 
Line 183 
         $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";

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

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