summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-10-12 14:41:45 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-10-12 14:41:45 (GMT)
commite152a0e3c11f80db76bd6fbd03a986bd9635b024 (patch)
treec0479338cd787c8eebcab5e36ff8992cbe0edbcc
parent51866dc50d5807b891a2c65e6f654724bb82aba6 (diff)
globale dialoge now uses broadcast date
-rw-r--r--INFO24
-rwxr-xr-xrhautoimport-gd38
2 files changed, 41 insertions, 21 deletions
diff --git a/INFO b/INFO
index 9a0dec2..a85a23f 100644
--- a/INFO
+++ b/INFO
@@ -1,7 +1,17 @@
*** add info about other importers... ***
+ (missing: btl, dn, er, eu, fl, nw, oi, po, rs, wr)
-- Radio Attac:
+- (gd) Women on Air presents: Globale Dialoge
+ https://cba.fro.at/series/globale-dialoge-women-on-air/feed
+
+ Original: wöchentlich Dienstags, 13:00
+ Upload: manchmal einen tag davor, oft bis zu 3 Tage danach
+ Such-Kriterium: cba:productionDate
+ RH: wöchentlich, Montag, 13:30-14:30
+ wöchentlich, Donnerstag, 08:00-09:00, Wiederholung
+
+- (ra) Radio Attac:
https://cba.fro.at/series/radioattac/feed
Original: wöchentlich Montags
@@ -10,7 +20,7 @@
RH: wöchentlich, Mittwoch, 15:00-15:30
wöchentlich, Samstag, 15:30-16:00, Wiederholung
-- Tierrechtsradio:
+- (tr) Tierrechtsradio:
https://cba.fro.at/series/tierrechtsradio/feed
Original: wöchentlich Freitags
@@ -18,7 +28,7 @@
Such-Kriterium: cba:broadcastDate
RH: wöchentlich, Freitag, 08:00-09:00
-- Eigenklang:
+- (ek) Eigenklang:
https://cba.fro.at/series/eigenklang/feed
Original: letzter Montag im Monat
@@ -26,7 +36,7 @@
Such-Kriterium: cba:broadcastDate
RH: 4wöchentlich, Woche 2, Dienstag, 08:30-09:30
-- Fokus Bildung:
+- (fb) Fokus Bildung:
https://cba.fro.at/series/fokus-bildung-bildung-im-fokus/feed
Original: erster Montag im Monat
@@ -35,7 +45,7 @@
nicht immer gesetzt!! (~1 von 5 mal)
RH: 4wöchentlich, Woche 2, Mittwoch, 14:30-15:00
-- derive:
+- (dv) derive:
https://cba.fro.at/series/derive-radio-fuer-stadtforschung/feed
Original: erster Dienstag im Monat
@@ -47,7 +57,7 @@
RH: 4wöchentlich, Woche 3, Dienstag, 16:00-16:30
4wöchtenlich, Woche 2, Mittwoch, 14:00-14:30, Wiederholung
-- Pura Vida Sounds:
+- (pv) Pura Vida Sounds:
https://cba.fro.at/series/pura-vida-sounds/feed
Original: monatlich
@@ -57,7 +67,7 @@
aktuellste spielen (manchmal 2 statt eine Wiederh.)
RH: 2wöchentlich, Woche 2/4, Montag, 16:00-17:00
-- X_XY (Un)gelöst und (Un)erhört!:
+- (xy) X_XY (Un)gelöst und (Un)erhört!:
https://cba.fro.at/series/x_xy-ungeloest-und-unerhoert/feed
Original: 2wöchentlich, Woche 2/4, Freitag
diff --git a/rhautoimport-gd b/rhautoimport-gd
index d025025..99dc63b 100755
--- a/rhautoimport-gd
+++ b/rhautoimport-gd
@@ -23,6 +23,7 @@
use strict;
use Date::Calc;
+use DateTime::Format::Strptime;
use XML::Feed;
use XML::Feed::Entry;
use XML::Feed::Content;
@@ -40,6 +41,7 @@ my $RD_GROUP = "womenonair";
my $PV_ID = '210';
my $TITLE="Women on Air present: Globale Dialoge";
my $LAST_RUN = 0;
+my $upload_delay_days = 1; # files are usually delayed at least one day
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
@@ -70,27 +72,32 @@ my $show_id_reb = $allowed_dbs[$idx_reb]->{'SHOWID'};
my $show_title_reb = $allowed_dbs[$idx_reb]->{'SHOWTITLE'};
-my @today = Date::Calc::Standard_to_Business(Date::Calc::Today());
-my $dow = $today[2];
+my @today = Date::Calc::Today();
+my @tmp = Date::Calc::Standard_to_Business(@today);
+my $dow = $tmp[2];
if($dow > 1 && $dow < 5) {
print "please don't run this script Tuesday, Wednesday or Thursday!\n";
exit 42;
}
-$today[2] = 2;
-my @broadcast_day = Date::Calc::Business_to_Standard(@today);
+$tmp[2] = 2;
+my @broadcast_date = Date::Calc::Business_to_Standard(@tmp);
if($dow == 1) {
- @broadcast_day = Date::Calc::Add_Delta_Days(@broadcast_day, -7);
+ @broadcast_date = Date::Calc::Add_Delta_Days(@broadcast_date, -7);
}
-my @import_date = Date::Calc::Add_Delta_Days(@broadcast_day, 6);
+my @import_date = Date::Calc::Add_Delta_Days(@broadcast_date, 6);
my @import_date_reb = Date::Calc::Add_Delta_Days(@import_date, 3);
-print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_day) . "\n";
+print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n";
print "day of Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
print "day of Radio Helsinki rebroadcast: " . Date::Calc::Date_to_Text(@import_date_reb) . "\n";
-my $bd = sprintf("%04d-%02d-%02d", @broadcast_day);
-my $bdfile = sprintf("^%4d%02d%02d", @broadcast_day);
+if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
+ print "File won't be available by now!\n";
+ exit 42;
+}
-print "looking for files like '$bdfile' in RSS Feed\n";
+my $bd = sprintf("%04d-%02d-%02d", @broadcast_date);
+
+print "looking for files with cba:broadcastDate $bd in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
@@ -108,6 +115,13 @@ my $i = 0;
for my $entry ($feed->entries) {
$i++;
next unless $entry->enclosure;
+
+ my $entry_bdt = $entry->{'entry'}{'https://cba.fro.at/help#feeds'}{'broadcastDate'};
+ next unless (defined $entry_bdt);
+ my $bdt = DateTime::Format::Strptime::strptime("%a, %d %b %Y", $entry_bdt);
+
+ next unless($broadcast_date[0] == $bdt->year && $broadcast_date[1] == $bdt->month && $broadcast_date[2] == $bdt->day);
+
my $j = 0;
for my $enclosure($entry->enclosure) {
$j++;
@@ -121,10 +135,6 @@ for my $entry ($feed->entries) {
$uri = new URI::URL($orig_uri);
my @path = $uri->path_components;
$file = $path[-1];
- unless($file =~ /$bdfile/) {
- $uri = "";
- next;
- }
my $current_file = `cat $STAT_FILE`;
if($current_file eq $file) {