my $tsv_file = ( glob 'items.*' )[0];
-our $eprintsid = 700;
-
my $xml = read_file 'ep-xml.xml';
my @files = read_file "files.txt";
$file .= $1 if $full_path =~ m/(\.\w+)$/;
}
+ my $subject;
+ if ( $file =~ m/(\w+)/ ) {
+ $_ = $1;
+ $subject =
+ m/bib/i ? 'IZBIB' :
+ m/in[fo]/i ? 'IZDHI' :
+ m/muz/i ? 'IZMUZ' :
+ m/arh/i ? 'IZARH' :
+ die "unknown subject: $2";
+ }
+
my $c = $col;
- $header2col->{'eprintsid'} = $c; $v[$c++] = $eprintsid++;
$header2col->{'file'} = $c; $v[$c++] = $file;
$header2col->{'full_path'} = $c; $v[$c++] = $full_path;
+ $header2col->{'subject'} = $c; $v[$c++] = $subject;
my $eprints = $xml;
while ( $eprints =~ s/<!-- "(.+?)" -->/interpolate($1)/seg ) {
}
$eprints =~ s{<documents>.+</documents>}{<!-- no documents -->}s if ! $full_path;
+ $eprints =~ s{<subjects>.+</subjects>}{<!-- no subjects -->}s if ! $subject;
print $eprints;
}