diff options
author | Christian Pointner <equinox@helsinki.at> | 2022-08-10 11:06:23 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2022-08-10 11:06:23 (GMT) |
commit | 586b2d0c3274b89f7ee23a7052fb88febdc260cc (patch) | |
tree | 5dc0bc69bb5f5c5435b61c6cfdb42123fd28fcac | |
parent | 17e1b1acd55110ba6dd6057d1a05812119d1f343 (diff) |
update PO importer
-rw-r--r-- | INFO | 4 | ||||
-rwxr-xr-x | rhautoimport-po | 21 |
2 files changed, 12 insertions, 13 deletions
@@ -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); } |