summaryrefslogtreecommitdiff
path: root/rhautoimport-ra
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2019-08-28 10:29:48 (GMT)
committerChristian Pointner <equinox@helsinki.at>2019-08-28 10:29:48 (GMT)
commitd6fd6822681e2b65f619b99494b498eba40be2a8 (patch)
treeaca228cf1c243da143146758161979faf40c8fa9 /rhautoimport-ra
parent2c4d3fcacd16bcca0aa320b8bd86e91b00bea5a2 (diff)
make radio attac importer more resilient against wrong production date
Diffstat (limited to 'rhautoimport-ra')
-rwxr-xr-xrhautoimport-ra11
1 files changed, 8 insertions, 3 deletions
diff --git a/rhautoimport-ra b/rhautoimport-ra
index 7618fa9..371cb2f 100755
--- a/rhautoimport-ra
+++ b/rhautoimport-ra
@@ -90,7 +90,7 @@ if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
my $bd = sprintf("%04d-%02d-%02d", @broadcast_date);
-print "looking for files with cba:productionDate $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);
@@ -109,9 +109,14 @@ for my $entry ($feed->entries) {
$i++;
next unless $entry->enclosure;
- my $entry_bdt = $entry->{'entry'}{'https://cba.fro.at/help#feeds'}{'productionDate'};
+ 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);