From 9e5f1e46be83e69b669e620110f483c5fd831bba Mon Sep 17 00:00:00 2001 From: miker Date: Thu, 2 Aug 2007 17:26:40 +0000 Subject: [PATCH] Inspired by Don Hamilton, added a --quiet|-q switch to the import-related scripts git-svn-id: svn://svn.open-ils.org/ILS/trunk@7620 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/import/direct_ingest.pl | 5 +++-- Open-ILS/src/extras/import/marc2are.pl | 5 +++-- Open-ILS/src/extras/import/marc2bre.pl | 5 +++-- Open-ILS/src/extras/import/pg_loader.pl | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/extras/import/direct_ingest.pl b/Open-ILS/src/extras/import/direct_ingest.pl index 9ce3e339a0..d0b3eea910 100755 --- a/Open-ILS/src/extras/import/direct_ingest.pl +++ b/Open-ILS/src/extras/import/direct_ingest.pl @@ -26,12 +26,13 @@ use MARC::Charset; 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 @@ while (my $rec = <>) { postprocess( { bib => $bib, ingest_data => $data } ); - if (!($count % 20)) { + if (!$quiet && !($count % 20)) { print NEWERR "\r$count\t". $count / (time - $starttime); } diff --git a/Open-ILS/src/extras/import/marc2are.pl b/Open-ILS/src/extras/import/marc2are.pl index 652a6a64e7..a9f3e13b02 100755 --- a/Open-ILS/src/extras/import/marc2are.pl +++ b/Open-ILS/src/extras/import/marc2are.pl @@ -25,7 +25,7 @@ use MARC::Charset; 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 @@ GetOptions( 'password=s' => \$password, 'config=s' => \$config, 'file=s' => \@files, + 'quiet' => \$quiet, ); @files = @ARGV if (!@files); @@ -84,7 +85,7 @@ while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) { $count++; - if (!($count % 20)) { + if (!$quiet && !($count % 20)) { print STDERR "\r$count\t". $count / (time - $starttime); } } diff --git a/Open-ILS/src/extras/import/marc2bre.pl b/Open-ILS/src/extras/import/marc2bre.pl index 0dc99297d5..aa2cb9922f 100755 --- a/Open-ILS/src/extras/import/marc2bre.pl +++ b/Open-ILS/src/extras/import/marc2bre.pl @@ -21,7 +21,7 @@ use MARC::Charset; #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 @@ GetOptions( 'trash=s' => \@trash_fields, 'xml_idl=s' => \$idlfile, 'dontuse=s' => \$dontuse_file + 'quiet' => \$quiet ); if ($enc) { @@ -177,7 +178,7 @@ while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) { $count++; - if (!($count % 50)) { + if (!$quiet && !($count % 50)) { print STDERR "\r$count\t". $count / (time - $starttime); } } diff --git a/Open-ILS/src/extras/import/pg_loader.pl b/Open-ILS/src/extras/import/pg_loader.pl index eed76316eb..679f44edd6 100755 --- a/Open-ILS/src/extras/import/pg_loader.pl +++ b/Open-ILS/src/extras/import/pg_loader.pl @@ -14,7 +14,7 @@ use Time::HiRes qw/time/; 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 @@ GetOptions( 'wipe=s' => \@wipe, 'autoprimary=s' => \@auto, 'order=s' => \@order, + 'quiet' => \$quiet, ); my %lineset; @@ -65,14 +66,14 @@ while ( my $rec = <> ) { 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); -- 2.43.2