summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INFO8
-rwxr-xr-xrhautoimport-dv2
-rwxr-xr-xrhautoimport-ek2
-rwxr-xr-xrhautoimport-fb2
-rwxr-xr-xrhautoimport-gd8
-rwxr-xr-xrhautoimport-nw3
-rwxr-xr-xrhautoimport-po2
-rwxr-xr-xrhautoimport-pv3
-rwxr-xr-xrhautoimport-ra3
-rwxr-xr-xrhautoimport-rs2
-rwxr-xr-xrhautoimport-tr50
-rwxr-xr-xrhautoimport-wr33
-rwxr-xr-xrhautoimport-xy3
13 files changed, 69 insertions, 52 deletions
diff --git a/INFO b/INFO
index 65b76b0..9a0dec2 100644
--- a/INFO
+++ b/INFO
@@ -10,6 +10,14 @@
RH: wöchentlich, Mittwoch, 15:00-15:30
wöchentlich, Samstag, 15:30-16:00, Wiederholung
+- Tierrechtsradio:
+ https://cba.fro.at/series/tierrechtsradio/feed
+
+ Original: wöchentlich Freitags
+ Upload: meistens am selben Tag, nachmittags
+ Such-Kriterium: cba:broadcastDate
+ RH: wöchentlich, Freitag, 08:00-09:00
+
- Eigenklang:
https://cba.fro.at/series/eigenklang/feed
diff --git a/rhautoimport-dv b/rhautoimport-dv
index e709eb1..bdaec42 100755
--- a/rhautoimport-dv
+++ b/rhautoimport-dv
@@ -120,7 +120,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 for broadcast date $bd in RSS Feed\n";
+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);
diff --git a/rhautoimport-ek b/rhautoimport-ek
index 469f3b7..5302b23 100755
--- a/rhautoimport-ek
+++ b/rhautoimport-ek
@@ -115,7 +115,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 for broadcast date $bd in RSS Feed\n";
+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);
diff --git a/rhautoimport-fb b/rhautoimport-fb
index 9f879a1..917ddf5 100755
--- a/rhautoimport-fb
+++ b/rhautoimport-fb
@@ -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 for broadcast date $bd in RSS Feed\n";
+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);
diff --git a/rhautoimport-gd b/rhautoimport-gd
index 0fef8d2..d025025 100755
--- a/rhautoimport-gd
+++ b/rhautoimport-gd
@@ -88,7 +88,9 @@ print "day of Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_dat
print "day of Radio Helsinki rebroadcast: " . Date::Calc::Date_to_Text(@import_date_reb) . "\n";
my $bd = sprintf("%04d-%02d-%02d", @broadcast_day);
-print "looking for files from $bd in RSS Feed\n";
+my $bdfile = sprintf("^%4d%02d%02d", @broadcast_day);
+
+print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
@@ -97,8 +99,6 @@ unless ($result) {
exit 1;
}
-my $bdexp = sprintf("^%4d%02d%02d", @broadcast_day);
-
my $uri = "";
my $file = "";
my $sum_title = "";
@@ -121,7 +121,7 @@ for my $entry ($feed->entries) {
$uri = new URI::URL($orig_uri);
my @path = $uri->path_components;
$file = $path[-1];
- unless($file =~ /$bdexp/) {
+ unless($file =~ /$bdfile/) {
$uri = "";
next;
}
diff --git a/rhautoimport-nw b/rhautoimport-nw
index ae9c45b..e24a998 100755
--- a/rhautoimport-nw
+++ b/rhautoimport-nw
@@ -90,7 +90,8 @@ print "day of Radio Helsinki rebroadcast: " . Date::Calc::Date_to_Text(@import_d
my $id = sprintf("%04d-%02d-%02d", @import_date);
my $bd = sprintf("%04d-%02d-%02d", @broadcast_day);
my $bdfile = sprintf("NETWATCHER[-_]?%04d%02d%02d(.*)\.MP3", @broadcast_day);
-print "looking for files from $bd in RSS Feed\n";
+
+print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
diff --git a/rhautoimport-po b/rhautoimport-po
index aa44c13..13153c4 100755
--- a/rhautoimport-po
+++ b/rhautoimport-po
@@ -110,7 +110,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 for broadcast date $bd in RSS Feed\n";
+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);
diff --git a/rhautoimport-pv b/rhautoimport-pv
index d06a885..ef7b1b5 100755
--- a/rhautoimport-pv
+++ b/rhautoimport-pv
@@ -100,7 +100,8 @@ 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);
my $bdfile = sprintf("^%04d-?%02d-?%02d", @broadcast_date);
-print "looking for files from $bd in RSS Feed\n";
+
+print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
diff --git a/rhautoimport-ra b/rhautoimport-ra
index 710bd64..7618fa9 100755
--- a/rhautoimport-ra
+++ b/rhautoimport-ra
@@ -89,7 +89,8 @@ if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
}
my $bd = sprintf("%04d-%02d-%02d", @broadcast_date);
-print "looking for files from $bd in RSS Feed\n";
+
+print "looking for files with cba:productionDate $bd in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
diff --git a/rhautoimport-rs b/rhautoimport-rs
index f34b543..ff76c53 100755
--- a/rhautoimport-rs
+++ b/rhautoimport-rs
@@ -130,7 +130,7 @@ my $id = sprintf("%04d-%02d-%02d", @import_date);
my $bd = sprintf("%04d-%02d-%02d", @broadcast_date);
my $bdfile = sprintf("RAST%04d-?%02d-?%02d(CBA)?(.*)\.MP3", @broadcast_date);
-print "looking for files from $bd in RSS Feed\n";
+print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);
diff --git a/rhautoimport-tr b/rhautoimport-tr
index b10815f..541d2d7 100755
--- a/rhautoimport-tr
+++ b/rhautoimport-tr
@@ -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,18 +41,12 @@ my $RD_GROUP = "tierrecht";
my $PV_ID = '506';
my $TITLE="Tierrechtsradio";
my $LAST_RUN = 0;
+my $upload_delay_days = 0; # files are usally there on the same day of the original broadcast
binmode(STDIN, ":utf8");
binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");
-my @today = Date::Calc::Standard_to_Business(Date::Calc::Today());
-if($today[2] == 5) {
- print "please don't run this script on fridays!\n";
- rhautoimport::report_title_and_last($TITLE, 0);
- exit 42;
-}
-
if($#ARGV >= 0 && $ARGV[0] eq 'last') {
print "!!!This is the last attempt, there won't be a retry on error!!!\n";
$LAST_RUN = 1;
@@ -73,18 +68,25 @@ my $show_id = $allowed_dbs[0]->{'SHOWID'};
my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
-my @broadcast_day = Date::Calc::Business_to_Standard($today[0], $today[1], 5);
-if($today[2] < 5) {
- @broadcast_day = Date::Calc::Add_Delta_Days(@broadcast_day, -7);
+my @today = Date::Calc::Today();
+my @tmp = Date::Calc::Standard_to_Business(@today);
+my @broadcast_date = Date::Calc::Business_to_Standard($tmp[0], $tmp[1], 5);
+if($tmp[2] < 5) {
+ @broadcast_date = Date::Calc::Add_Delta_Days(@broadcast_date, -7);
}
-my @import_date = Date::Calc::Add_Delta_Days(@broadcast_day, 7);
-print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_day) . "\n";
+my @import_date = Date::Calc::Add_Delta_Days(@broadcast_date, 7);
+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";
+if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
+ print "File won't be available by now!\n";
+ exit 42;
+}
+
my $id = sprintf("%04d-%02d-%02d", @import_date);
-my $bd = sprintf("%04d-%02d-%02d", @broadcast_day);
-my $bdfile = sprintf("^%04d-?%02d-?%02d", @broadcast_day);
-print "looking for files from $bd 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);
@@ -102,6 +104,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 %H:%M:%S", $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++;
@@ -115,13 +124,10 @@ for my $entry ($feed->entries) {
$uri = new URI::URL($orig_uri);
my @path = $uri->path_components;
$file = $path[-1];
- unless(uc($file) =~ $bdfile) { # file not from correct day
- $uri = "";
- next;
- }
- my $current_file = `cat $STAT_FILE`;
- if($current_file eq $file) {
+ my $current_stat = `cat $STAT_FILE`;
+ my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/;
+ if($current_id eq $id && $current_file eq $file) {
print "Already downloaded file of today\n";
exit 42;
}
@@ -172,7 +178,7 @@ if($ret) {
unlink($STAT_FILE);
open(my $fhs, '>', $STAT_FILE);
-print $fhs "$file";
+print $fhs "$id\n$file";
close($fhs);
exit $exit_code;
diff --git a/rhautoimport-wr b/rhautoimport-wr
index 457d068..a5ece8b 100755
--- a/rhautoimport-wr
+++ b/rhautoimport-wr
@@ -59,6 +59,20 @@ if($curweek == 1 || $curweek == 3) {
rhautoimport::report_title_and_last($TITLE, $LAST_RUN);
+my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
+if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
+ print "$allowed_dbs[1]\n";
+ exit 1;
+}
+
+if(scalar(@allowed_dbs) != 1) {
+ print "found more or less than one Dropbox for this group?!\n";
+ exit 1;
+}
+my $show_id = $allowed_dbs[0]->{'SHOWID'};
+my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
+
+
my @today = Date::Calc::Today();
print "today: " . Date::Calc::Date_to_Text(@today) . " (Week: " . $curweek . ")\n";
@@ -74,27 +88,12 @@ if($curweek == 1 || $curweek == 3) {
} else {
@import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
}
-print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
-
-
-my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
-if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
- print "$allowed_dbs[1]\n";
- exit 1;
-}
-
-if(scalar(@allowed_dbs) != 1) {
- print "found more or less than one Dropbox for this group?!\n";
- exit 1;
-}
-my $show_id = $allowed_dbs[0]->{'SHOWID'};
-my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
-
my @broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 1, 3);
if(Date::Calc::Delta_Days(@broadcast_date, @import_date) <= 0) {
my @tmp_date = Date::Calc::Add_Delta_YM(@broadcast_date, 0, -1);
@broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($tmp_date[0], $tmp_date[1], 1, 3);
}
+print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
print "day of latest original broadcast before next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n";
if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
@@ -105,7 +104,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 for broadcast date $bd in RSS Feed\n";
+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);
diff --git a/rhautoimport-xy b/rhautoimport-xy
index 6027ed7..b5e046c 100755
--- a/rhautoimport-xy
+++ b/rhautoimport-xy
@@ -100,7 +100,8 @@ 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);
my $bdfile = sprintf("^0?%d-?0?%d-?%04d", $broadcast_date[2], $broadcast_date[1], $broadcast_date[0]);
-print "looking for files from $bd in RSS Feed\n";
+
+print "looking for files like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);