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 /rhautoimport-gd | |
parent | 399375784fc3458b1a5e59788b7c73ba1d3caeda (diff) |
GD importer: only use broadcast date if set and fall back to production date if not
Diffstat (limited to 'rhautoimport-gd')
-rwxr-xr-x | rhautoimport-gd | 7 |
1 files changed, 6 insertions, 1 deletions
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); |