[open-ils-commits] r7620 - trunk/Open-ILS/src/extras/import

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 2 13:28:46 EDT 2007


Author: miker
Date: 2007-08-02 13:26:40 -0400 (Thu, 02 Aug 2007)
New Revision: 7620

Modified:
   trunk/Open-ILS/src/extras/import/direct_ingest.pl
   trunk/Open-ILS/src/extras/import/marc2are.pl
   trunk/Open-ILS/src/extras/import/marc2bre.pl
   trunk/Open-ILS/src/extras/import/pg_loader.pl
Log:
Inspired by Don Hamilton, added a --quiet|-q switch to the import-related scripts

Modified: trunk/Open-ILS/src/extras/import/direct_ingest.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/direct_ingest.pl	2007-08-02 15:12:02 UTC (rev 7619)
+++ trunk/Open-ILS/src/extras/import/direct_ingest.pl	2007-08-02 17:26:40 UTC (rev 7620)
@@ -26,12 +26,13 @@
 
 MARC::Charset->ignore_errors(1);
 
-my ($auth, $config) =
+my ($auth, $config, $quiet) =
 	(0, '/openils/conf/opensrf_core.xml');
 
 GetOptions(
 	'config=s'	=> \$config,
 	'authority'	=> \$auth,
+	'quiet'		=> \$quiet,
 );
 
 my @ses;
@@ -71,7 +72,7 @@
 
 	postprocess( { bib => $bib, ingest_data => $data } );
 
-	if (!($count % 20)) {
+	if (!$quiet && !($count % 20)) {
 		print NEWERR "\r$count\t". $count / (time - $starttime);
 	}
 

Modified: trunk/Open-ILS/src/extras/import/marc2are.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2are.pl	2007-08-02 15:12:02 UTC (rev 7619)
+++ trunk/Open-ILS/src/extras/import/marc2are.pl	2007-08-02 17:26:40 UTC (rev 7620)
@@ -25,7 +25,7 @@
 
 MARC::Charset->ignore_errors(1);
 
-my ($utf8, $id_field, $count, $user, $password, $config, $marctype, $keyfile,  @files, @trash_fields) =
+my ($utf8, $id_field, $count, $user, $password, $config, $marctype, $keyfile,  @files, @trash_fields, $quiet) =
 	(0, '998', 1, 'admin', 'open-ils', '/openils/conf/opensrf_core.xml', 'USMARC');
 
 GetOptions(
@@ -35,6 +35,7 @@
 	'password=s'	=> \$password,
 	'config=s'	=> \$config,
 	'file=s'	=> \@files,
+	'quiet'		=> \$quiet,
 );
 
 @files = @ARGV if (!@files);
@@ -84,7 +85,7 @@
 
 	$count++;
 
-	if (!($count % 20)) {
+	if (!$quiet && !($count % 20)) {
 		print STDERR "\r$count\t". $count / (time - $starttime);
 	}
 }

Modified: trunk/Open-ILS/src/extras/import/marc2bre.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/marc2bre.pl	2007-08-02 15:12:02 UTC (rev 7619)
+++ trunk/Open-ILS/src/extras/import/marc2bre.pl	2007-08-02 17:26:40 UTC (rev 7620)
@@ -21,7 +21,7 @@
 
 #MARC::Charset->ignore_errors(1);
 
-my ($id_field, $recid, $user, $config, $idlfile, $marctype, $keyfile, $dontuse_file, $enc, $force_enc, @files, @trash_fields) =
+my ($id_field, $recid, $user, $config, $idlfile, $marctype, $keyfile, $dontuse_file, $enc, $force_enc, @files, @trash_fields, $quiet) =
 	('', 1, 1, '/openils/conf/opensrf_core.xml', '/openils/conf/fm_IDL.xml', 'USMARC');
 
 GetOptions(
@@ -37,6 +37,7 @@
 	'trash=s'	=> \@trash_fields,
 	'xml_idl=s'	=> \$idlfile,
 	'dontuse=s'	=> \$dontuse_file
+	'quiet'		=> \$quiet
 );
 
 if ($enc) {
@@ -177,7 +178,7 @@
 
 	$count++;
 
-	if (!($count % 50)) {
+	if (!$quiet && !($count % 50)) {
 		print STDERR "\r$count\t". $count / (time - $starttime);
 	}
 }

Modified: trunk/Open-ILS/src/extras/import/pg_loader.pl
===================================================================
--- trunk/Open-ILS/src/extras/import/pg_loader.pl	2007-08-02 15:12:02 UTC (rev 7619)
+++ trunk/Open-ILS/src/extras/import/pg_loader.pl	2007-08-02 17:26:40 UTC (rev 7620)
@@ -14,7 +14,7 @@
 use Getopt::Long;
 
 my @files;
-my ($config, $output, @auto, @order, @wipe) =
+my ($config, $output, @auto, @order, @wipe, $quiet) =
 	('/openils/conf/opensrf_core.xml');
 
 GetOptions(
@@ -23,6 +23,7 @@
 	'wipe=s'	=> \@wipe,
 	'autoprimary=s'	=> \@auto,
 	'order=s'	=> \@order,
+	'quiet'		=> \$quiet,
 );
 
 my %lineset;
@@ -65,14 +66,14 @@
 
 	push @{ $lineset{$hint} }, [map { $row->$_ } @{ $fieldcache{$hint}{fields} }];
 
-	if (!($count % 500)) {
+	if (!$quiet && !($count % 500)) {
 		print STDERR "\r$count\t". $count / (time - $starttime);
 	}
 
 	$count++;
 }
 
-print STDERR "\nWriting file ...\n";
+print STDERR "\nWriting file ...\n" if (!$quiet);
 
 $output = '&STDOUT' unless ($output);
 $output = FileHandle->new(">$output") if ($output);



More information about the open-ils-commits mailing list