File: dlrobot.pl

package info (click to toggle)
rccp 0.9-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 244 kB
  • ctags: 44
  • sloc: ansic: 830; sh: 256; perl: 134; makefile: 71
file content (36 lines) | stat: -rwxr-xr-x 820 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl 
#downloading robot for CCCP by hampa@chello.se
#this script should not be run by itself
#usage:
#./startrobot

$home = $ENV{HOME};

opendir(DONEDIR, "$home/dc/done") or die "unable to open ~/dc/done/ directory";
@dlfiles = readdir DONEDIR;


while(<STDIN>){
	#nick|file|size|slots|hubname|ip
	chomp;
	($nick, $path, $size, $slots, $hubname, $ip) = split /\|/;

	@y = split /\\/,$path;
	$filename = $y[scalar(@y) - 1];
	$match = 0;

	#print "size $size filename $filename path $path nick $nick hubname $hubname\n";
	
	###############################################
	#if we have the file
	#dont download it again
	foreach $dl (@dlfiles){
		if($remotefilename eq $dl){
			$match = 1;
			print "file $filename exist.. skipping\n";
		}
	}
	if(!$match){
		system "cccp -N -O -d \"*$nick**$path*$size\""
	}
}