diff options
author | Christian Pointner <equinox@helsinki.at> | 2018-06-22 13:38:56 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2018-06-22 13:38:56 (GMT) |
commit | 32a70b14ab7b88b7831d1753157b2f45c73a58c8 (patch) | |
tree | 3b417acd15994be811067004e3a9f52d2674adbc | |
parent | 399375784fc3458b1a5e59788b7c73ba1d3caeda (diff) |
GD importer: only use broadcast date if set and fall back to production date if not
-rw-r--r-- | INFO | 2 | ||||
-rwxr-xr-x | rhautoimport-gd | 7 |
2 files changed, 7 insertions, 2 deletions
@@ -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); |