From 0cb635749fd8aca004879850b2b9f456e9921b91 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Tue, 25 Jun 2013 00:19:09 +0000 Subject: [PATCH] Add ability to make it run quietly to reduce mail size. --- marc_export_custom/marc_export_custom | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/marc_export_custom/marc_export_custom b/marc_export_custom/marc_export_custom index 21ba612..def5da2 100755 --- a/marc_export_custom/marc_export_custom +++ b/marc_export_custom/marc_export_custom @@ -25,7 +25,7 @@ use Data::Dumper; my @formats = qw/USMARC UNIMARC XML BRE ARE/; -my ($config,$format,$encoding,$location,$dollarsign,$idl,$help,$holdings,$timeout,$export_mfhd,$type,$all_records) = ('/openils/conf/opensrf_core.xml','USMARC','MARC8','','$',0,undef,undef,0,undef,'biblio',undef); +my ($config,$format,$encoding,$location,$dollarsign,$idl,$help,$holdings,$timeout,$export_mfhd,$type,$all_records,$quiet) = ('/openils/conf/opensrf_core.xml','USMARC','MARC8','','$',0,undef,undef,0,undef,'biblio',undef,0); my ($exclusion_ini,$collapse_to_depth, $output_file); my $cfg; my $force901; @@ -49,6 +49,7 @@ GetOptions( 'collapse_to_depth=i' => \$collapse_to_depth, 'onlyholdings' => \$onlyholdings, 'output-file=s' => \$output_file, + 'quiet' => \$quiet, ); if ($exclusion_ini) { @@ -244,7 +245,7 @@ sub export_record { if ($format eq 'ARE' or $format eq 'BRE') { print $outfh OpenSRF::Utils::JSON->perl2JSON($bib); - stats(); + stats() unless $quiet; $count{did}++; return; } @@ -353,7 +354,7 @@ sub export_record { } } - stats() if (! ($count{bib} % 50 )); + stats() if (!$quiet && ! ($count{bib} % 50 )); } sub stats { @@ -641,7 +642,7 @@ sub add_bib_holdings { - stats() if (! ($count{cp} % 100 )); + stats() if (!$quiet && ! ($count{cp} % 100 )); } # COPYMAP: for my $cp ( @$cn_map_list ) } # for my $cn ( @$cn_list ) } # if ($cp_list && @$cp_list) @@ -653,5 +654,5 @@ sub skipnote { my $note = shift; my $outf = *STDERR; $outf = *STDOUT if($output_file) ; - printf($outf "Skipped %s due to config: %s\n",$id,$note); + printf($outf "Skipped %s due to config: %s\n",$id,$note) unless $quiet; } -- 2.3.6