From 01ff101609b75b59b55e9530073a74e83f527af6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 30 Jan 2019 14:20:37 +0100 Subject: make date selection for Panoptikum robust diff --git a/INFO b/INFO index 551ba03..2e763af 100644 --- a/INFO +++ b/INFO @@ -1,6 +1,6 @@ *** add info about other importers... *** - (missing: dn, er, eu, fl, nw, oi, po, rs) + (missing: dn, er, eu, fl, nw, oi, rs) - (wr) Werkstatt-Radio https://cba.fro.at/series/werkstatt-radio/feed @@ -137,3 +137,11 @@ Such-Kriterium: fortlaufende Nummer in Titel und Dateiname RH: wöchentlich, Donnerstag 17:50-18:00 und Samstag 17:50-18:00 keine Wiederholung + +- (po) Panoptikum Bildung: + https://cba.fro.at/series/panoptikum-bildung/feed + + Original: erster und 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 diff --git a/rhautoimport-po b/rhautoimport-po index 13153c4..49947fb 100755 --- a/rhautoimport-po +++ b/rhautoimport-po @@ -42,7 +42,7 @@ my $RD_GROUP = "panoptikum"; my $PV_ID = '570'; my $TITLE="Panoptikum"; my $LAST_RUN = 0; -my $upload_delay_days = 0; # files are usally there on the same day of the original broadcast +my $upload_delay_days = 3; # files are usally there 3 days after the original broadcast binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); @@ -110,7 +110,7 @@ if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) { my $id = sprintf("%04d-%02d-%02d", @import_date); my $bd = sprintf("%04d-%02d-%02d", @broadcast_date); -print "looking for files with cba:broadcastDate $bd in RSS Feed\n"; +print "looking for files with cba:broadcastDate $bd in RSS Feed (will be using cba:productionDate if cba:broadcastDate is not set)\n"; print " -> $RSS_URL\n"; my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL); @@ -130,8 +130,13 @@ for my $entry ($feed->entries) { next unless $entry->enclosure; my $entry_bdt = $entry->{'entry'}{'https://cba.fro.at/help#feeds'}{'broadcastDate'}; + my $format_string = "%a, %d %b %Y %H:%M:%S"; + unless (defined $entry_bdt) { + $entry_bdt = $entry->{'entry'}{'https://cba.fro.at/help#feeds'}{'productionDate'}; + $format_string = "%a, %d %b %Y"; + } next unless (defined $entry_bdt); - my $bdt = DateTime::Format::Strptime::strptime("%a, %d %b %Y %H:%M:%S", $entry_bdt); + my $bdt = DateTime::Format::Strptime::strptime($format_string, $entry_bdt); next unless($broadcast_date[0] == $bdt->year && $broadcast_date[1] == $bdt->month && $broadcast_date[2] == $bdt->day); -- cgit v0.10.2