projects
/
koha-eprints
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3a12a2a
)
cleanup code a bit
author
dpavlin
<dpavlin@rot13.org>
Tue, 26 May 2015 11:54:04 +0000
(13:54 +0200)
committer
dpavlin
<dpavlin@rot13.org>
Tue, 26 May 2015 11:54:50 +0000
(13:54 +0200)
tsv2eprints.pl
patch
|
blob
|
history
diff --git
a/tsv2eprints.pl
b/tsv2eprints.pl
index
a275fa4
..
7c9ea89
100755
(executable)
--- a/
tsv2eprints.pl
+++ b/
tsv2eprints.pl
@@
-64,8
+64,6
@@
$repo->terminate();
=cut
=cut
-our $eprintid = 1;
-
my $files;
my $mkp_path = "/mnt/share/MKP/ELEKTRONIÄŒKI DOKUMENTI/EL.DOKUMENTI PO BIBLIOBROJU/";
my $files;
my $mkp_path = "/mnt/share/MKP/ELEKTRONIÄŒKI DOKUMENTI/EL.DOKUMENTI PO BIBLIOBROJU/";
@@
-103,6
+101,7
@@
my $last_offset = 0;
my @cols;
while(<$tsv_fh>) {
my @cols;
while(<$tsv_fh>) {
+ chomp;
my $line = $_;
$line =~ s/[\n\r]+$//;
my $line = $_;
$line =~ s/[\n\r]+$//;
@@
-111,7
+110,7
@@
while(<$tsv_fh>) {
next;
}
next;
}
- my @v = split(/\t/, $
_
, $#cols + 1);
+ my @v = split(/\t/, $
line
, $#cols + 1);
my %row;
@row{@cols} = @v;
#warn "## row = ",dump( \%row );
my %row;
@row{@cols} = @v;
#warn "## row = ",dump( \%row );
@@
-119,9
+118,7
@@
while(<$tsv_fh>) {
my $offset = $row{offset} // die "no offset";
my $biblionumber = $row{biblionumber} || die "no biblionumber";
my $offset = $row{offset} // die "no offset";
my $biblionumber = $row{biblionumber} || die "no biblionumber";
- warn "# ", join(' ', map { $row{$_} } qw(offset biblionumber title)), "\n";
-
- exit if $ENV{LAST} && $eprintid >= $ENV{LAST};
+# warn "# ", join(' ', map { $row{$_} } qw(biblionumber title)), "\n";
if ( delete $files->{$biblionumber} ) {
$stat->{file}++;
if ( delete $files->{$biblionumber} ) {
$stat->{file}++;
@@
-136,7
+133,9
@@
while(<$tsv_fh>) {
seek $marc_fh, $last_offset, 0;
read $marc_fh, my $marc, $offset - $last_offset;
print $import_fh $marc;
seek $marc_fh, $last_offset, 0;
read $marc_fh, my $marc, $offset - $last_offset;
print $import_fh $marc;
- warn "# marc $biblionumber\n";
+ warn "# NEW ", join(' ', map { $row{$_} } qw(biblionumber title)), "\n";
+# warn "# NEW $biblionumber\n";
+
}
} else {
}
} else {
@@
-160,6
+159,7
@@
foreach my $biblionumber ( keys %$files ) {
if ( my $marc = get("https://koha.ffzg.hr/cgi-bin/koha/opac-export.pl?op=export&bib=$biblionumber&format=utf8") ) {
print $import_fh $marc;
warn "## marc $biblionumber from koha!";
if ( my $marc = get("https://koha.ffzg.hr/cgi-bin/koha/opac-export.pl?op=export&bib=$biblionumber&format=utf8") ) {
print $import_fh $marc;
warn "## marc $biblionumber from koha!";
+ $stat->{koha}++;
} else {
warn "ERROR: can't fetch $biblionumber from koha";
}
} else {
warn "ERROR: can't fetch $biblionumber from koha";
}