diff options
Diffstat (limited to 'rhautoimport-ra')
-rwxr-xr-x | rhautoimport-ra | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/rhautoimport-ra b/rhautoimport-ra index ff95bcc..3570dab 100755 --- a/rhautoimport-ra +++ b/rhautoimport-ra @@ -40,6 +40,10 @@ my $RD_GROUP = "RadioATTAC"; my $PV_ID = '76'; my $LAST_RUN = 0; +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "!!!This is the last attempt, there won't be a retry on error!!!\n"; $LAST_RUN = 1; @@ -141,13 +145,20 @@ if($uri eq "") { exit 1; } +my $exit_code = 0; print "\n\nwill import '$uri' to show $show_id, $show_title\n"; my ($ret, $log, $keptfile_uri) = rhautoimport::import_uri($show_id, $uri->as_string, "keep"); if($ret == 0) { print "\nImport Success:\n\n"; print $log; print "\n"; - rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date), "1"); + ($ret, $log) = rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date), "1"); + print $log; + if($ret) { + print "\nIgnoring failed note import - manual intervention necessary!\n"; + $exit_code = 23; + } + print "\n"; if(!defined($keptfile_uri)) { @@ -162,12 +173,19 @@ if($ret == 0) { print "\nImport Success:\n\n"; print $log; print "\n"; - rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date_reb), "2"); + ($ret, $log) = rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date_reb), "2"); + print $log; + if($ret) { + print "\nIgnoring failed note import - manual intervention necessary!\n"; + $exit_code = 23; + } + } else { print "\nImport Error:\n\n"; print $log; print "\n\nNot adding PV note!!"; print "\n\nSince the import for the regular broadcast went through we will not retry this import!!!"; + $exit_code = 23; } } else { print "\nImport Error:\n\n"; @@ -181,4 +199,4 @@ open(my $fhs, '>', $STAT_FILE); print $fhs "$file"; close($fhs); -exit 0; +exit $exit_code; |