use Convert::UUlib ':all';
sub namefilter {
my($path)=@_;
$path=~s/^.*[\/\\]//;
$path;
}
sub busycb {
my ($action, $curfile, $partno, $numparts, $percent, $fsize) = @_;
$_[0]=straction($action);
print "busy_callback(", (join ",",@_), ")\n";
0;
}
SetOption OPT_IGNMODE, 1;
SetOption OPT_VERBOSE, 1;
SetFNameFilter \&namefilter;
SetBusyCallback "busycb", 333;
SetMsgCallback sub {
my ($msg, $level) = @_;
print uc strmsglevel $_[1], ": $msg\n";
};
SetFileNameCallback sub {
return unless $_[1]; local $_ = $_[0];
return $1 if /(\S{3,}\.(?:[rstuvwxyz]\d\d|rar))\s/i;
return $1 if /- "(.{2,}?\..+?)" (?:yenc )?\(\d+\/\d+\)/i;
return $1 if /- "?(\S{3,}\.\S+?)"? (?:yenc )?\(\d+\/\d+\)/i;
return $1 if /No\.[ 0-9]+ (\S+\....) (?:\d+ bytes )?\[/;
return ();
};
for(<uusrc/*>) {
my($retval,$count)=LoadFile ($_, $_, 1);
print "file($_), status(", strerror $retval, ") parts($count)\n";
}
SetOption OPT_SAVEPATH, "uudst/";
$i = 0;
while ($uu = GetFileListItem $i) {
$i++;
print "file nr. $i";
print " state ", $uu->state;
print " mode ", $uu->mode;
print " uudet ", strencoding $uu->uudet;
print " size ", $uu->size;
print " filename ", $uu->filename;
print " subfname ", $uu->subfname;
print " mimeid ", $uu->mimeid;
print " mimetype ", $uu->mimetype;
print "\n";
for ($uu->parts) {
while (my ($k, $v) = each %$_) {
print "$k > $v, ";
}
print "\n";
}
$uu->decode_temp;
print " temporarily decoded to ", $uu->binfile, "\n";
$uu->remove_temp;
print strerror $uu->decode;
print " saved as uudst/", $uu->filename, "\n";
}
print "cleanup...\n";
CleanUp();