From c8366c1046abedb0017eb26f1036b7600548488f Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Wed, 25 Sep 2019 16:32:24 +0200
Subject: das-mensch: broadcast vs production date


diff --git a/INFO b/INFO
index ab02852..6ba830b 100644
--- a/INFO
+++ b/INFO
@@ -121,7 +121,7 @@
 
    Original: zweiter Donnerstag im Monat
    Upload: meist 2-3 tage danach
-   Such-Kriterium: cba:productionDate
+   Such-Kriterium: cba:broadcastDate wenn gesetzt sonst cba:productionDate
    RH: 4wöchentlich, Woche 2, Dienstag, 13:00-14:00
 
 - (ab) A Year Abroad:
diff --git a/debian/changelog b/debian/changelog
index 90ea7d2..72ebc1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+rhautoimport (59-1) unstable; urgency=medium
+
+  * das mensch broadcast vs production date
+
+ -- Christian Pointner <equinox@helsinki.at>  Wed, 25 Sep 2019 16:31:08 +0200
+
 rhautoimport (58-1) unstable; urgency=medium
 
   * configure upload delay for ba
diff --git a/rhautoimport-dm b/rhautoimport-dm
index 5ccb95b..394c301 100755
--- a/rhautoimport-dm
+++ b/rhautoimport-dm
@@ -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: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);
@@ -128,9 +128,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);
 
-- 
cgit v0.10.2