X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=tsv2eprints.pl;fp=tsv2eprints.pl;h=7535069f06c169656aa3044fbafb0018232fa5bb;hb=869f1cde378c7074b67379348a2778076a131a9c;hp=62e75211c7a8fbcfde2d206000bbdf88311cb26a;hpb=18fec644db05c4274532a345a8ecc9089b4141e3;p=koha-eprints diff --git a/tsv2eprints.pl b/tsv2eprints.pl index 62e7521..7535069 100755 --- a/tsv2eprints.pl +++ b/tsv2eprints.pl @@ -249,8 +249,11 @@ print qq{ }; -open(my $tsv_fh, '<:encoding(UTF-8)', "$koha_path.tsv"); -open(my $tsv_marc, '<:encoding(UTF-8)', "$koha_path.marc"); +open(my $tsv_fh, '<:encoding(UTF-8)', "$koha_path.tsv"); +open(my $marc_fh, '<', "$koha_path.marc"); +open(my $import_fh, '>', "$koha_path.import.marc"); + +my $last_offset = 0; while(<$tsv_fh>) { my $line = $_; @@ -266,10 +269,18 @@ while(<$tsv_fh>) { if ( $item->{full_path} = $files->{$biblionumber} ) { $stat->{file}++; + + seek $marc_fh, $last_offset, 0; + read $marc_fh, my $marc, $offset - $last_offset; + print $import_fh $marc; + warn "# marc $biblionumber $title\n"; + } else { $stat->{missing}++; } + $last_offset = $offset; + } print qq{