#!c:/perl/bin/perl use strict; use LWP::UserAgent; require LWP; use URI; use LWP::RobotUA; require LWP::RobotUA; use Globals; use Globals qw(%ALLPLATTERS); use Globals qw($MINTRAWL); use Globals qw($delim); use Globals qw(@MUSIC); use Globals qw(@VIDEO); use Globals qw(@SHORTCUT); use Globals qw($debug); use Globals qw($bgcolour); use CGI qw(:standard); $|=1; my $QUERY = CGI::new(); my $NAMELIST = $QUERY->param( "hosts" ); my $NAME; my $HOST; my $BASE; my %ABCS; my $HEADER = new HTTP::Headers( 'Accept' => 'text/plain', 'User-Agent' => 'PlatterTwaartter/3.0.0', 'Dixon' => 'Am-Hammy-Twaart' ); my $ROBOT_NAME = "PlatterTwaartter"; my $ROBOT_OWNER = "chris.dixon\@hammytwaart.com"; my $USERAGENT; my $RECURSE=0; # Stop weird parent links setting us up the bomb my $LINECOUNT = 0; my $QUICKEXT = $delim.join($delim, (@MUSIC, @VIDEO, @SHORTCUT)).$delim; # Print the header # my $TEMPLATE = openTemplate ("trawl"); $TEMPLATE =~ s/%MINTRAWL%/$MINTRAWL/g; $TEMPLATE =~ s/%BGCOLOUR%/$bgcolour/g; print $TEMPLATE; if ( defined $NAMELIST ) { # Lock the inventory against meddling by pesky kids if (-e "../inventory/trawl.lock") { print '
The Distroplat inventory is currently locked by another user. Please try again in a bit. Bye.
'; exit(0); } open (LOCK, ">../inventory/trawl.lock"); close(LOCK); # Load the ABCs %ABCS = getABCs(); #Set up the user agent $USERAGENT = new LWP::RobotUA $ROBOT_NAME, $ROBOT_OWNER; # go as fast as you can $USERAGENT->delay(0); $USERAGENT->timeout(15); # seconds - doesn't seem to work though # Deal with each server in turn my @SPLITNAME = split(',', $NAMELIST); print "Indexed $count tracks in ".(time-$TIME)." seconds.";
}
}
}
close INVENTORY;
close ARTISTS;
unless ($found) {
print "
Host $NAME is not registered platter host.";
}
}
# Re-write the abcs file
open ( ABC, ">../inventory/abcs.txt" );
my @abckeys = sort {uc($a) cmp uc($b)} keys %ABCS;
my $key;
foreach $key (@abckeys) {
print ABC $key.$delim.$ABCS{$key}."\n";
}
close ABC;
print "