summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INFO2
-rwxr-xr-xrhautoimport-btl8
2 files changed, 7 insertions, 3 deletions
diff --git a/INFO b/INFO
index de5a66b..c530482 100644
--- a/INFO
+++ b/INFO
@@ -45,7 +45,7 @@
Original: wöchentlich Mittwochs
Upload: immer am selben Tag
- Such-Kriterium: Dateiname im format 'YYmmdd-btlv128.mp3'
+ Such-Kriterium: RSS Issue Date, "broadcast-affiliate-version" im Dateinamen
es gibt wöchentlich neue Sendungen wir spielen jede zweite
RH: 2wöchentlich, Woche 2/4, Montag, 07:30-08:00
diff --git a/rhautoimport-btl b/rhautoimport-btl
index 3fd662d..35b4472 100755
--- a/rhautoimport-btl
+++ b/rhautoimport-btl
@@ -23,6 +23,7 @@
use strict;
use Date::Calc;
+use DateTime::Format::Strptime;
use XML::Feed;
use XML::Feed::Entry;
use XML::Feed::Content;
@@ -92,9 +93,9 @@ 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("%02d%02d%02d.*-btlv.*\.mp3", $broadcast_date[0]%100, $broadcast_date[1], $broadcast_date[2]);
+my $bdfile = ".*broadcast-affiliate-version.*\.mp3";
-print "looking for files like '$bdfile' in RSS Feed\n";
+print "looking for files issued on '$bd' and named like '$bdfile' in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss($RSS_URL);
@@ -112,6 +113,9 @@ for my $entry ($feed->entries) {
if($entry->enclosure && ($entry->enclosure->type eq "audio/mpeg" || entry->enclosure->type eq "audio/mp3")) {
next unless $entry->enclosure->url =~ /$bdfile/;
+ my $idt = DateTime::Format::Strptime::strptime("%Y-%m-%dT%H:%M:%S", $entry->issued);
+ next unless($broadcast_date[0] == $idt->year && $broadcast_date[1] == $idt->month && $broadcast_date[2] == $idt->day);
+
$uri = new URI::URL($entry->enclosure->url);
my @path = $uri->path_components;
$file = $path[-1];