summaryrefslogtreecommitdiff
path: root/rhautoimport-btl
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2019-05-08 14:47:13 (GMT)
committerChristian Pointner <equinox@helsinki.at>2019-05-08 14:47:13 (GMT)
commit4e3fbb8e630d56dfa5abb50db8fb20f48bd40672 (patch)
tree6ec11f3a8898c1faaaf34fe559eb83e5664a9e62 /rhautoimport-btl
parent8b7b5e9a6b28ca767a55f6750c4f3e8b575134f5 (diff)
fix importer for BTL
Diffstat (limited to 'rhautoimport-btl')
-rwxr-xr-xrhautoimport-btl8
1 files changed, 6 insertions, 2 deletions
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];