summaryrefslogtreecommitdiff
path: root/rhautoimport-po
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2022-08-10 11:06:23 (GMT)
committerChristian Pointner <equinox@helsinki.at>2022-08-10 11:06:23 (GMT)
commit586b2d0c3274b89f7ee23a7052fb88febdc260cc (patch)
tree5dc0bc69bb5f5c5435b61c6cfdb42123fd28fcac /rhautoimport-po
parent17e1b1acd55110ba6dd6057d1a05812119d1f343 (diff)
update PO importer
Diffstat (limited to 'rhautoimport-po')
-rwxr-xr-xrhautoimport-po21
1 files changed, 10 insertions, 11 deletions
diff --git a/rhautoimport-po b/rhautoimport-po
index 49947fb..150e782 100755
--- a/rhautoimport-po
+++ b/rhautoimport-po
@@ -50,7 +50,7 @@ binmode(STDERR, ":utf8");
my $curweek = RHRD::utils::get_rd_week();
-if($curweek == 2 || $curweek == 4) {
+if($curweek == 2) {
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;
@@ -67,12 +67,16 @@ $import_date[2] = 4;
@import_date = Date::Calc::Business_to_Standard(@import_date);
my $dow = Date::Calc::Day_of_Week(@today);
-if($curweek == 2 || $curweek == 4) {
+if($curweek == 1) {
+ @import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
+} elsif($curweek == 2) {
if($dow > 4) {
- @import_date = Date::Calc::Add_Delta_Days(@import_date, 14);
+ @import_date = Date::Calc::Add_Delta_Days(@import_date, 28);
}
+} elsif($curweek == 3) {
+ @import_date = Date::Calc::Add_Delta_Days(@import_date, 21);
} else {
- @import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
+ @import_date = Date::Calc::Add_Delta_Days(@import_date, 14);
}
print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
@@ -90,13 +94,8 @@ if(scalar(@allowed_dbs) != 1) {
my $show_id = $allowed_dbs[0]->{'SHOWID'};
my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
-my @broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 5, 1);
-if(Date::Calc::Delta_Days(@broadcast_date, @import_date) > 0) {
- my @tmp_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 5, 3);
- if(Date::Calc::Delta_Days(@tmp_date, @import_date) > 0) {
- @broadcast_date = @tmp_date;
- }
-} else {
+my @broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 5, 3);
+if(Date::Calc::Delta_Days(@broadcast_date, @import_date) <= 0) {
my @tmp_date = Date::Calc::Add_Delta_YM(@broadcast_date, 0, -1);
@broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($tmp_date[0], $tmp_date[1], 5, 3);
}