summaryrefslogtreecommitdiff
path: root/rhautoimport-ra
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-17 15:45:23 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-17 15:45:23 (GMT)
commit43613383b248e4c6d8ccfdac98ec114f127290d7 (patch)
tree2df9122fbd4732f3588288d6ad6bcb5e18798d13 /rhautoimport-ra
parentc37171a835f9a6abf45c8fef5f1564ed02e4d611 (diff)
(re)added binmode(utf8)
added special return code wich means success with errors
Diffstat (limited to 'rhautoimport-ra')
-rwxr-xr-xrhautoimport-ra24
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;