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

File: [local] / mp3 / bin / deleteplaylist.pl (download)

Revision 1.3, Thu Feb 8 20:04:03 2007 UTC (17 years, 2 months ago) by andrew
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +12 -3 lines

First shot at making multiple jukeboxes from the same files.

#!/usr/bin/perl -w
# $RedRiver: deleteplaylist.pl,v 1.2 2006/08/12 00:14:53 andrew Exp $
########################################################################
# DeletePlaylist.plx *** 
#
# 01-10-??
# Written by andrew fresh <andrew@mad-techies.org>
########################################################################
use strict;
use diagnostics;

use CGI qw/:standard/;           # load standard CGI routines
use CGI::Carp qw(fatalsToBrowser);

my $query = new CGI;

my $vars = $query->Vars;


########################################################################
# *** MAIN ***
########################################################################

my $prefix = $ENV{'QUERY_STRING'};
if ($prefix) {
        $prefix =~ s/%(..)/pack("c",hex($1))/ge;
} else {
        $prefix ='';
}

my $list = '/var/www/mp3/playlist/' . $prefix . 'playlist.lst';


print "Content-Type: text/html\n\n";
print "<html>\n<head>\n\t<meta HTTP-EQUIV='Pragma' CONTENT='no-cache'> <title>Deleting Playlist</title>\n";
print "<body>\n\n";
 
#MakeTemp("$configs{DIRftp}/$station/$configs{FILESnew}");
#use File::Copy;
#copy("$configs{DIRcfgs}/$station.$configs{FILEplaylist}", "$configs{DIRftp}/$station/$station.$configs{FILEplaylist}");

#Print_Nav();
 
if ($$vars{confirm} && ($$vars{confirm} eq "true")) { 
	delplaylist();
} else {
	confirm();
}
 
print "<a href=\"showfiles.pl\">Back to Beginning</a>";
print "</body>\n</head>\n</html>\n";

sub confirm {
	print "<h2>Confirm Playlist Delete</h2>\n";
	print "<P>Do you really want to do this?  Would you want someone deleting <I>YOUR</I> playlist?</P>\n";
	print "<p><a href=\"deleteplaylist.pl\?confirm=true\">Click here to confirm Playlist Deletion</a></p>\n";
}


sub delplaylist {
	print "<h2>Deleting Playlist</h2>\n";
	if (-e $list) {
		if (open FILE, ">$list") {
                        print FILE "";
                        print "<p>Playlist deleted</p>\n";
                        close FILE;
		} else {
			print "<p>Could not delete playlist.  Maybe it's already deleted? If not, please wait 90 seconds and try again and if that doesn't work contact the system administrator</p>\n";
		}
	} else {
		print "<p>Could not delete playlist.  It doesn't seem that there was a playlist.  You know it plays all the time now right?</p>\n";
	}
}


sub Print_Nav
{
	open FILE, 'nav.inc' or die "\n\ncouldn't open FILE nav.inc: $!";
	while (<FILE>) {
		print;
	}
	close FILE;
}