changeset 56:9d7df218f94c

added more bib-formats improved online_mode
author casties
date Fri, 27 Aug 2010 19:10:28 +0200
parents 7958ac21f9bf
children 2208ed7370cb
files makemeta-vlp.pl
diffstat 1 files changed, 52 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/makemeta-vlp.pl	Tue Aug 11 16:34:59 2009 +0200
+++ b/makemeta-vlp.pl	Fri Aug 27 19:10:28 2010 +0200
@@ -10,7 +10,7 @@
 $|=1;
 
 # program version
-my $version = "0.2.6 (1.2.2009 ROC)";
+my $version = "0.2.7 (27.8.2010 ROC)";
 my $help = 
 "use: makemeta-vlp [options] file.xml
 options:
@@ -20,6 +20,7 @@
   -online-mode  mode for creating online/permanent files
   -archive-mode  mode for creating archive/data files
   -access=free  adds free access tag for online-mode
+  -texttool adds texttool tag for online-mode
 ";
 logger("INFO", "makemeta-vlp $version");
 
@@ -120,6 +121,16 @@
 	'Pages' => 'meta/bib/number-of-pages',
 	'#Cover pages only, articles have been extracted' => 'meta/bib/comment'
     },
+    'Journal' => {
+	'_name' => 'report',
+	'Title' => 'meta/bib/title',
+	'SecondaryTitle' => 'meta/bib/institution',
+	'Author' => 'meta/bib/author',
+	'Place_Published' => 'meta/bib/city',
+	'Year' => 'meta/bib/year',
+	'Date' => 'meta/bib/date',
+	'Pages' => 'meta/bib/pages',
+    },
     'Magazine Article' => {
 	'_name' => 'magazine-article',
 	'Author' => 'meta/bib/author',
@@ -130,6 +141,15 @@
 	'Date' => 'meta/bib/issue-date',
 	'Pages' => 'meta/bib/pages'
     },
+    'Newspaper Article' => {
+	'_name' => 'newspaper-article',
+	'Author' => 'meta/bib/author',
+	'Title' => 'meta/bib/title',
+	'Year' => 'meta/bib/year',
+	'Secondary_Title' => 'meta/bib/newspaper',
+	'Date' => 'meta/bib/issue-date',
+	'Pages' => 'meta/bib/pages'
+    },
     'Report' => {
 	'_name' => 'report',
 	'Author' => 'meta/bib/author',
@@ -190,6 +210,7 @@
     );
 # storage fields
 my $arch_id_field = 'ID';
+my $access_free_field = 'online';
 
 #######################################################
 # internal parameters
@@ -225,6 +246,12 @@
 my $archive_mode = (exists $$args{'archive-mode'}) ? $$args{'archive-mode'} : 0;
 logger('DEBUG', "archive_mode: $archive_mode");
 
+# create texttool tag (online mode only)
+my $texttool = (exists $$args{'texttool'}) ? $$args{'texttool'} : 1;
+logger('DEBUG', "texttool: $texttool");
+# image dir for texttool
+my $texttool_img_dir = "pages";
+
 # access type
 my $access_type = (exists $$args{'access'}) ? $$args{'access'} : "";
 
@@ -283,7 +310,11 @@
 	return;
     }
     my $dir = "$online_base/lit$dest_id";
-    return $dir;
+    if (-d $dir) {
+        logger('DEBUG', "directory $dir exists"); 
+        return $dir;
+    }
+    return;
 }
 
 
@@ -428,6 +459,25 @@
 	    my $acc_tag = create_element_path('meta/access-conditions/access@type=institution', $index_root, $namespace);
 	    create_text_path('name', $access_type, $acc_tag, $namespace);
 	}
+    } elsif ($online_mode) {
+        # read access conditions from "online" field in DB dump
+        my $online = sstrip($input_node->findvalue("fm:$access_free_field"));
+        if ($online) {
+	    create_element_path('meta/access-conditions/access@type=free', $index_root, $namespace);
+	} else {
+	    my $acc_tag = create_element_path('meta/access-conditions/access@type=institution', $index_root, $namespace);
+	    create_text_path('name', 'mpiwg', $acc_tag, $namespace);
+	}
+    }
+
+    # texttool tag with image dir
+    if ($online_mode && $texttool) {
+	if ( -d "$doc_dir/$texttool_img_dir" ) {
+	    create_text_path('meta/texttool/image', $texttool_img_dir,$index_root, $namespace);
+	} else {
+            logger('WARNING', "page image directory missing!");
+            $warncnt++;
+        }
     }
 
     # convert bib entries