#!/bin/sh -xe
+
#cd "/mnt/share/MKP/ELEKTRONIÄŒKI DOKUMENTI/EL.DOKUMENTI PO BIBLIOBROJU/do18052015/"
#find . -name '[0-9]*.pdf' -print | sed 's,./,,' | tee pdf-files.list
+
sudo -u eprints /usr/share/eprints3/bin/epadmin update snz
+
+./tsv2eprints.pl
+
sudo -u eprints /usr/share/eprints3/bin/epadmin --force erase_eprints snz
-sudo -u eprints /usr/share/eprints3/bin/import --update --migration --enable-web-imports --enable-file-imports --enable-import-fields --force snz eprint MARC /tmp/koha_ffzg.marc
+sudo -u eprints /usr/share/eprints3/bin/import --update --migration --enable-web-imports --enable-file-imports --enable-import-fields --force snz eprint MARC /tmp/koha_ffzg.import.marc
sudo -u eprints /usr/share/eprints3/bin/generate_views snz
};
-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 = $_;
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{