[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/acqui.simple marcimport.pl,1.5,1.6 processz3950qu
From: |
Steve Tonnesen |
Subject: |
[Koha-devel] CVS: koha/acqui.simple marcimport.pl,1.5,1.6 processz3950queue,1.2,1.3 |
Date: |
Fri Feb 1 10:02:12 2002 |
Update of /cvsroot/koha/koha/acqui.simple
In directory usw-pr-cvs1:/tmp/cvs-serv32238/koha/acqui.simple
Modified Files:
marcimport.pl processz3950queue
Log Message:
Changes from a long time ago that I don't even remember anymore. :)
Index: marcimport.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/marcimport.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** marcimport.pl 2001/11/06 18:13:59 1.5
--- marcimport.pl 2002/02/01 18:00:28 1.6
***************
*** 829,839 ****
($author) && ($author="by $author");
if ($isbn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&isbn=$isbn>$title$subtitle
$author</a> $donetext<br>\n";
} elsif ($lccn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&lccn=$lccn>$title$subtitle
$author</a> $donetext<br>\n";
} elsif ($issn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&issn=$issn>$title$subtitle
$author</a><br> $donetext\n";
} elsif ($controlnumber) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&controlnumber=$controlnumber>$title
$author</a><br> $donetext\n";
} else {
print "Error: Contact steve regarding $title by
$author<br>\n";
--- 829,839 ----
($author) && ($author="by $author");
if ($isbn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&isbn=$isbn>$title
$subtitle $author</a> $donetext<br>\n";
} elsif ($lccn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&lccn=$lccn>$title
$subtitle $author</a> $donetext<br>\n";
} elsif ($issn) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&issn=$issn>$title
$subtitle $author</a><br> $donetext\n";
} elsif ($controlnumber) {
! print "<li><a
href=$ENV{'SCRIPT_NAME'}?file=$file&resultsid=$resultsid&controlnumber=$controlnumber>$title
$subtitle $author</a><br> $donetext\n";
} else {
print "Error: Contact steve regarding $title by
$author<br>\n";
Index: processz3950queue
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/processz3950queue,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** processz3950queue 2001/11/06 18:13:59 1.2
--- processz3950queue 2002/02/01 18:00:28 1.3
***************
*** 25,29 ****
my $now=time();
$stk=$dbh->prepare("select
id,server,startdate,enddate,numrecords,active from z3950results where
queryid=$id");
! $stk->execute;
my %serverdone;
unless ($stk->rows) {
--- 25,29 ----
my $now=time();
$stk=$dbh->prepare("select
id,server,startdate,enddate,numrecords,active from z3950results where
queryid=$id");
! ($stk->execute) || (next);
my %serverdone;
unless ($stk->rows) {
***************
*** 82,88 ****
($resultsid) = $stj->fetchrow;
} else {
! my $stj=$dbi->prepare("insert into z3950results
(server, queryid, startdate) values ($q_serverinfo, $id, $now)");
$stj->execute;
! $resultsid=$dbi->{'mysql_insertid'};
}
my $stj=$dbh->prepare("update z3950results set active=1
where id=$resultsid");
--- 82,93 ----
($resultsid) = $stj->fetchrow;
} else {
! my $stj=$dbi->prepare("select id from z3950results
where server=$q_serverinfo and queryid=$id");
$stj->execute;
! ($resultsid) = $stj->fetchrow;
! unless ($resultsid) {
! my $stj=$dbi->prepare("insert into z3950results
(server, queryid, startdate) values ($q_serverinfo, $id, $now)");
! $stj->execute;
! $resultsid=$dbi->{'mysql_insertid'};
! }
}
my $stj=$dbh->prepare("update z3950results set active=1
where id=$resultsid");
***************
*** 90,168 ****
my $conn;
my $noconnection=0;
if ($user) {
eval { $conn= new
Net::Z3950::Connection($servername, $port, databaseName => $database, user =>
$user, password => $password); };
if ($@) {
$noconnection=1;
}
- pe();
} else {
eval { $conn= new
Net::Z3950::Connection($servername, $port, databaseName => $database); };
if ($@) {
$noconnection=1;
}
- pe();
}
! if ($noconnection) {
} else {
my $rs=$conn->search($query);
- pe();
- $rs->option(preferredRecordSyntax =>
Net::Z3950::RecordSyntax::USMARC);
- pe();
- my $numresults=$rs->size();
pe();
! my $i;
! my $result='';
! my $scantimerstart=time();
! for ($i=1; $i<=(($numresults<80) ? ($numresults) :
(80)); $i++) {
! my $rec=$rs->record($i);
! my $marcdata=$rec->rawdata();
! $result.=$marcdata;
! }
! my $scantimerend=time();
! my $numrecords;
! ($numresults<80) ? ($numrecords=$numresults) :
($numrecords=80);
! my $elapsed=$scantimerend-$scantimerstart;
! if ($elapsed) {
! my $speed=int($numresults/$elapsed*100)/100;
! print " SPEED: $speed $server done
$numrecords\n";
! }
! my $q_result=$dbi->quote($result);
! ($q_result) || ($q_result='""');
! $now=time();
! my $task="update z3950results set
numrecords=$numresults,numdownloaded=$numrecords,highestseen=0,results=$q_result,enddate=$now
where id=$resultsid";
! my $stj=$dbi->prepare($task);
! $stj->execute;
! my $counter=0;
! while ($counter<60 && $numrecords<$numresults) {
! $counter++;
! my $stj=$dbi->prepare("select highestseen from
z3950results where id=$resultsid");
$stj->execute;
! my ($highestseen) = $stj->fetchrow;
! if ($highestseen>($numrecords-30)) {
! $counter=0;
! print " $server rescanning\n";
! my $scantimerstart=time();
! for ($i=$numrecords+1;
$i<=(($numresults<($numrecords+40)) ? ($numresults) : ($numrecords+40)); $i++) {
! my $rec=$rs->record($i);
! my $marcdata=$rec->rawdata();
! $result.=$marcdata;
! }
! my $scantimerend=time();
! ($numresults<$numrecords+40) ?
($numrecords=$numresults) : ($numrecords=$numrecords+40);
! my $elapsed=$scantimerend-$scantimerstart;
! if ($elapsed) {
! my
$speed=int($numresults/$elapsed*100)/100;
! print " SPEED: $speed $server done
$numrecords\n";
! }
!
! my $q_result=$dbi->quote($result);
! ($q_result) || ($q_result='""');
! $now=time();
! my $task="update z3950results set
numdownloaded=$numrecords,results=$q_result where id=$resultsid";
! my $stj=$dbi->prepare($task);
$stj->execute;
}
- sleep 5;
}
}
--- 95,181 ----
my $conn;
my $noconnection=0;
+ my $error=0;
if ($user) {
eval { $conn= new
Net::Z3950::Connection($servername, $port, databaseName => $database, user =>
$user, password => $password); };
if ($@) {
$noconnection=1;
+ } else {
+ $error=pe();
}
} else {
eval { $conn= new
Net::Z3950::Connection($servername, $port, databaseName => $database); };
if ($@) {
$noconnection=1;
+ } else {
+ $error=pe();
}
}
! if ($noconnection || $error) {
} else {
+ print "Q: $query\n";
my $rs=$conn->search($query);
pe();
! eval { $rs->option(preferredRecordSyntax =>
Net::Z3950::RecordSyntax::USMARC);};
! if ($@) {
! print "ERROR: address@hidden";
! } else {
! pe();
! my $numresults=$rs->size();
! pe();
! my $i;
! my $result='';
! my $scantimerstart=time();
! for ($i=1; $i<=(($numresults<80) ?
($numresults) : (80)); $i++) {
! my $rec=$rs->record($i);
! my $marcdata=$rec->rawdata();
! $result.=$marcdata;
! }
! my $scantimerend=time();
! my $numrecords;
! ($numresults<80) ? ($numrecords=$numresults) :
($numrecords=80);
! my $elapsed=$scantimerend-$scantimerstart;
! if ($elapsed) {
! my $speed=int($numresults/$elapsed*100)/100;
! print " SPEED: $speed $server done
$numrecords\n";
! }
! my $q_result=$dbi->quote($result);
! ($q_result) || ($q_result='""');
! $now=time();
! my $task="update z3950results set
numrecords=$numresults,numdownloaded=$numrecords,highestseen=0,results=$q_result,enddate=$now
where id=$resultsid";
! my $stj=$dbi->prepare($task);
$stj->execute;
! my $counter=0;
! while ($counter<60 && $numrecords<$numresults) {
! $counter++;
! my $stj=$dbi->prepare("select highestseen
from z3950results where id=$resultsid");
$stj->execute;
+ my ($highestseen) = $stj->fetchrow;
+ if ($highestseen>($numrecords-30)) {
+ $counter=0;
+ print " $server rescanning\n";
+ my $scantimerstart=time();
+ for ($i=$numrecords+1;
$i<=(($numresults<($numrecords+40)) ? ($numresults) : ($numrecords+40)); $i++) {
+ my $rec=$rs->record($i);
+ my $marcdata=$rec->rawdata();
+ $result.=$marcdata;
+ }
+ my $scantimerend=time();
+ ($numresults<$numrecords+40) ?
($numrecords=$numresults) : ($numrecords=$numrecords+40);
+ my
$elapsed=$scantimerend-$scantimerstart;
+ if ($elapsed) {
+ my
$speed=int($numresults/$elapsed*100)/100;
+ print " SPEED: $speed $server
done $numrecords\n";
+ }
+
+ my $q_result=$dbi->quote($result);
+ ($q_result) || ($q_result='""');
+ $now=time();
+ my $task="update z3950results set
numdownloaded=$numrecords,results=$q_result where id=$resultsid";
+ my $stj=$dbi->prepare($task);
+ $stj->execute;
+ }
+ sleep 5;
}
}
}
***************
*** 174,178 ****
exit;
sub pe {
! (return) unless ($code);
my $code=$conn->errcode();
my $msg=$conn->errmsg();
--- 187,191 ----
exit;
sub pe {
! return 0;
my $code=$conn->errcode();
my $msg=$conn->errmsg();
***************
*** 184,187 ****
--- 197,204 ----
EOF
+ # if ($msg =~/not yet available/) {
+ # return 1;
+ # }
+ return 0;
}
}
***************
*** 204,208 ****
$lastrun=time();
}
! sleep 1;
}
--- 221,225 ----
$lastrun=time();
}
! sleep 10;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/acqui.simple marcimport.pl,1.5,1.6 processz3950queue,1.2,1.3,
Steve Tonnesen <=