From 2d1d346df2b40eecfc82803d57f15a3165cdf898 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Thu, 2 Jun 2016 13:42:58 +0200
Subject: fixed last-run warning


diff --git a/rhautoimport-er b/rhautoimport-er
index 34b431d..31033db 100755
--- a/rhautoimport-er
+++ b/rhautoimport-er
@@ -46,9 +46,13 @@ 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;
+my $curweek = RHRD::utils::get_rd_week();
+
+if($curweek == 1 || $curweek == 3) {
+  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;
+  }
 }
 
 
@@ -65,8 +69,6 @@ if(scalar(@allowed_dbs) != 1) {
 my $show_id = $allowed_dbs[0]->{'SHOWID'};
 my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
 
-my $curweek = RHRD::utils::get_rd_week();
-
 my @today = Date::Calc::Today();
 my @import_date = Date::Calc::Standard_to_Business(@today);
 $import_date[2] = 5;
diff --git a/rhautoimport-wr b/rhautoimport-wr
index 8d92402..d81aa9b 100755
--- a/rhautoimport-wr
+++ b/rhautoimport-wr
@@ -46,12 +46,15 @@ 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;
+my $curweek = RHRD::utils::get_rd_week();
+
+if($curweek == 1 || $curweek == 3) {
+  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;
+  }
 }
 
-my $curweek = RHRD::utils::get_rd_week();
 
 my @today = Date::Calc::Today();
 print "today: " . Date::Calc::Date_to_Text(@today) . " (Week: " . $curweek . ")\n";
@@ -71,7 +74,6 @@ if($curweek == 1 || $curweek == 3) {
 print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
 
 
-
 my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
 if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
   print "$allowed_dbs[1]\n";
-- 
cgit v0.10.2