From 586b2d0c3274b89f7ee23a7052fb88febdc260cc Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 10 Aug 2022 13:06:23 +0200 Subject: update PO importer diff --git a/INFO b/INFO index ceaba86..1c6c492 100644 --- a/INFO +++ b/INFO @@ -88,10 +88,10 @@ - (po) Panoptikum Bildung: https://cba.fro.at/series/panoptikum-bildung/feed - Original: erster und dritter Freitag im Monat + Original: dritter Freitag im Monat Upload: meistens 3 Tage danach Such-Kriterium: cba:broadcastDate wenn gesetzt sonst cba:productionDate - RH: 2wöchentlich, Woche 2/4, Donnerstag, 09:00-10:00 + RH: 4wöchentlich, Woche 2, Donnerstag, 09:00-10:00 - (ba) barrierefrei aufgerollt https://cba.fro.at/series/barrierefrei-aufgerollt/feed 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); } -- cgit v0.10.2