summaryrefslogtreecommitdiff
path: root/rhautoimport-ab
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2018-05-16 20:46:21 (GMT)
committerChristian Pointner <equinox@helsinki.at>2018-05-16 20:46:21 (GMT)
commit399375784fc3458b1a5e59788b7c73ba1d3caeda (patch)
treef22037ce9e607cbd57bcf8d3e05273419e7e2a81 /rhautoimport-ab
parentd5fa7fe6f279d96e3ed637519d424fe4264f21f0 (diff)
ab: use production date if broadcast date is not set
Diffstat (limited to 'rhautoimport-ab')
-rwxr-xr-xrhautoimport-ab9
1 files changed, 7 insertions, 2 deletions
diff --git a/rhautoimport-ab b/rhautoimport-ab
index 3ff1b53..3a2e25f 100755
--- a/rhautoimport-ab
+++ b/rhautoimport-ab
@@ -109,7 +109,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);
@@ -129,8 +129,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);