use EPrints;
+my $stat;
+
my $ep = EPrints->new();
my $repo = $ep->repository( 'snz' );
#$repo->{config}->{enable_file_imports} = 1;
$info->{biblionumber}->{$biblionumber}++;
$info->{count}++;
+ $stat->{snz}++;
}, $info );
warn dump( $info );
store $files, "$koha_path.biblionumber.file";
-my $stat;
-
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");
+open(my $darhiv_fh, '>', "$koha_path.darhiv.marc");
-my $last_offset = 0;
+our $offset;
+our $biblionumber;
my @cols;
+sub output_marc {
+ my $output_fh = shift;
+ seek $marc_fh, $offset, 0;
+ read $marc_fh, my $marc_len, 5;
+ seek $marc_fh, $offset, 0;
+
+ read $marc_fh, my $marc, $marc_len;
+ print $output_fh $marc;
+}
+
while(<$tsv_fh>) {
chomp;
my $line = $_;
my @v = split(/\t/, $line, $#cols + 1);
my %row;
@row{@cols} = @v;
-#warn "## row = ",dump( \%row );
+ warn "## row = ",dump( \%row );
+ $stat->{tsv_rows}++;
- my $offset = $row{offset} // die "no offset";
- my $biblionumber = $row{biblionumber} || die "no biblionumber";
+ $offset = $row{offset} // die "no offset";
+ $biblionumber = $row{biblionumber} || die "no biblionumber";
# warn "# ", join(' ', map { $row{$_} } qw(biblionumber title)), "\n";
$stat->{new}++;
- seek $marc_fh, $offset, 0;
- read $marc_fh, my $marc_len, 5;
- seek $marc_fh, $offset, 0;
-
- read $marc_fh, my $marc, $marc_len;
- print $import_fh $marc;
+ output_marc $import_fh;
warn "# NEW ", join(' ', map { $row{$_} } qw(biblionumber title)), "\n";
# warn "# NEW $biblionumber\n";
}
+ # darhiv export to marc
+ if ( $row{agerestriction} > 0 ) {
+ output_marc $darhiv_fh;
+ $stat->{darhiv}++;
+ }
+
} else {
$stat->{missing}++;
}