From 32a70b14ab7b88b7831d1753157b2f45c73a58c8 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 22 Jun 2018 15:38:56 +0200 Subject: GD importer: only use broadcast date if set and fall back to production date if not diff --git a/INFO b/INFO index efec0c5..1e37409 100644 --- a/INFO +++ b/INFO @@ -24,7 +24,7 @@ Original: wöchentlich Dienstags, 13:00 Upload: manchmal einen tag davor, oft bis zu 3 Tage danach - Such-Kriterium: cba:productionDate + Such-Kriterium: cba:broadcastDate wenn gesetzt sonst cba:productionDate RH: wöchentlich, Montag, 13:30-14:30 wöchentlich, Donnerstag, 08:00-09:00, Wiederholung diff --git a/rhautoimport-gd b/rhautoimport-gd index 99dc63b..698e8e3 100755 --- a/rhautoimport-gd +++ b/rhautoimport-gd @@ -117,8 +117,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", $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