]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Freshmeat.pl
- bot stats: "blah has blah... is ranked xx/yy (zz percentile)"
[infobot.git] / src / Modules / Freshmeat.pl
index cb6f7fdf262e3c4e4bd45104be91b747f2d3aff2..269eb3e019d29e1a05240aaaf12b6a1ea12c1acf 100644 (file)
@@ -22,7 +22,7 @@ sub Freshmeat {
     my $refresh        = &::getChanConfDefault("freshmeatRefreshInterval",
                        "", 24) * 60 * 60 * 7;
 
-    my $last_refresh = &::dbGet("freshmeat", "projectname_short", "_", "latest_version");
+    my $last_refresh = &::dbGet("freshmeat", "latest_version", "projectname_short='_'");
     my $renewtable   = 0;
 
     if (defined $last_refresh and $last_refresh =~ /^\d+$/) {
@@ -84,7 +84,8 @@ sub Freshmeat {
 
 sub showPackage {
     my ($pkg)  = @_;
-    my @fm     = &::dbGet("freshmeat", "projectname_short", $pkg, "*");
+    my @fm     = &::dbGet("freshmeat", "*",
+                       "projectname_short=".&::dbQuote($pkg) );
 
     if (scalar @fm) {          #1: perfect match of name.
        my $retval;
@@ -183,9 +184,13 @@ sub downloadIndex {
 
     ### lets get on with business.
     # set the last refresh time. fixes multiple spawn bug.
-    &::dbSet("freshmeat", "projectname_short", "_", "latest_version", time());
+    &::dbSet("freshmeat", 
+       { "projectname_short"   => "_" },
+       { "latest_version"      => time()
+         "desc_short"          => "" }
+    );
 
-    &::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
+#    &::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
     @cols      = &::dbGetColInfo("freshmeat");
 
     $locktime  = time();
@@ -231,6 +236,12 @@ sub downloadIndex {
                s/æ/a/g;
                s/ø/o/g;
                s/ð/e/g;
+               s/ß//g;
+               s/·//g;
+       }
+
+       if (0 and $str =~ s/\&(\S+?);//g) {
+           &::DEBUG("fm: sarred $1 to ''.");
        }
 
        $p->parse($str, ProtocolEncoding => 'ISO-8859-1');
@@ -238,7 +249,7 @@ sub downloadIndex {
     }
     close IN;
 
-    &::dbRaw("UNLOCK", "UNLOCK TABLES");
+#    &::dbRaw("UNLOCK", "UNLOCK TABLES");
 
     my $delta_time = &::timedelta($start_time);
     &::status(sprintf("Freshmeat: %.02f sec to complete.", $delta_time)) if ($delta_time > 0);
@@ -320,7 +331,7 @@ sub xml_end {
        }
        $i++;
 
-       &::dbSetRow("freshmeat", @data);
+       &::dbSetRow("freshmeat", [@data], "DELAY");
        undef @data;
        undef %pkg;
 
@@ -333,10 +344,10 @@ sub xml_end {
            # I think the following leaks 120k of memory each time it's
            # called... the wonders of libmysql-perl leaking!
 
-           &::dbRaw("UNLOCK", "UNLOCK TABLES");
+#          &::dbRaw("UNLOCK", "UNLOCK TABLES");
            ### another lame hack to "prevent" errors.
-           select(undef, undef, undef, 0.2);
-           &::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
+#          select(undef, undef, undef, 0.2);
+#          &::dbRaw("LOCK", "LOCK TABLES freshmeat WRITE");
        }
     }
 }