git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@149
c11ca15a-4712-0410-83d8-
924469b57eb5
&downloadIndex();
&Freshmeat($sstr);
} );
&downloadIndex();
&Freshmeat($sstr);
} );
+ # both parent/fork runs here, in case the following looks weird.
return if ($$ == $main::bot_pid);
}
return if ($$ == $main::bot_pid);
}
my $start_time = &main::gettimeofday();
my %hash;
my $start_time = &main::gettimeofday();
my %hash;
+ # search by key/NAME first.
foreach (&main::searchTable("freshmeat", "name","name",$sstr)) {
$hash{$_} = 1 unless exists $hash{$_};
}
foreach (&main::searchTable("freshmeat", "name","name",$sstr)) {
$hash{$_} = 1 unless exists $hash{$_};
}
+ # search by description line.
foreach (&main::searchTable("freshmeat", "name","oneliner", $sstr)) {
$hash{$_} = 1 unless exists $hash{$_};
last if (scalar keys %hash > 15);
foreach (&main::searchTable("freshmeat", "name","oneliner", $sstr)) {
$hash{$_} = 1 unless exists $hash{$_};
last if (scalar keys %hash > 15);
my @list = keys %hash;
# search by value, if we have enough room to do it.
if (scalar @list == 1) {
my @list = keys %hash;
# search by value, if we have enough room to do it.
if (scalar @list == 1) {
- &main::DEBUG("only one partial match found; showing full info.");
+ &main::status("only one match found; showing full info.");
&showPackage($list[0]);
return;
}
&showPackage($list[0]);
return;
}
- ### TODO: do not dump full contents to an array.
- ### => process on the fly instead but how?
open(IN, $idx);
# delete the table before we redo it.
open(IN, $idx);
# delete the table before we redo it.
if ($i % 100 == 0 and $i != 0) {
&main::DEBUG("FM: unlocking and locking.");
&main::dbRaw("UNLOCK", "UNLOCK TABLES");
if ($i % 100 == 0 and $i != 0) {
&main::DEBUG("FM: unlocking and locking.");
&main::dbRaw("UNLOCK", "UNLOCK TABLES");
- sleep 1; # another lame hack to "prevent" errors.
+ ### another lame hack to "prevent" errors.
+ select(undef, undef, undef, 0.2);
&main::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
}
&main::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
}
my $file = "$main::bot_base_dir/Temp/fm_recent.txt";
my @old;
my $file = "$main::bot_base_dir/Temp/fm_recent.txt";
my @old;
+ ### if file exists, lets read it.
if ( -f $file) {
open(IN, $file);
while (<IN>) {
if ( -f $file) {
open(IN, $file);
while (<IN>) {
+ ### if file does not exist, write new.
if (! -f $file) {
open(OUT, ">$file");
foreach (@now) {
if (! -f $file) {
open(OUT, ">$file");
foreach (@now) {
&main::notice($_, $line);
}
&main::notice($_, $line);
}
open(OUT, ">$file");
foreach (@now) {
print OUT "$_\n";
open(OUT, ">$file");
foreach (@now) {
print OUT "$_\n";