eprints-dev: /home/dpavlin/tsv2xp-xml.pl [commit]
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 18 Oct 2010 19:59:19 +0000 (21:59 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 18 Oct 2010 19:59:19 +0000 (21:59 +0200)
tsv2xp-xml.pl

index 2991632..ccae475 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
-# sudo -u eprints /usr/share/eprints3/bin/import --verbose --migration ffzg eprint XML dipl.xml
+# ./tsv2xp-xml.pl 2>/dev/null > ep-diplomski.xml
+# sudo -u eprints /usr/share/eprints3/bin/import --verbose --migration ffzg eprint XML ep-diplomski.xml
 
 use warnings;
 use strict;
@@ -8,7 +9,7 @@ use strict;
 use File::Slurp;
 use Data::Dump qw(dump);
 
-my $tsv_file = 'items.mentor_ime.mentor_perzime.IME_FILE_a.PREZIME.IME.NAZIV_RADA.MENTOR.GOD_OBR63a8814e199c9b969dbe8251fdef0fa2';
+my $tsv_file = ( glob 'items.*' )[0];
 
 our $eprintsid = 700;
 
@@ -65,6 +66,7 @@ while(<$tsv>) {
        if ( my $full = $file2path->{ lc $file } ) {
                $full_path = $full;
                warn "# file $file -> $full_path\n";
+               $file .= $1 if $full_path =~ m/(\.\w+)$/;
        }
 
        my $c = $col;