diff options
author | Christian Pointner <equinox@helsinki.at> | 2019-05-08 14:47:13 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2019-05-08 14:47:13 (GMT) |
commit | 4e3fbb8e630d56dfa5abb50db8fb20f48bd40672 (patch) | |
tree | 6ec11f3a8898c1faaaf34fe559eb83e5664a9e62 | |
parent | 8b7b5e9a6b28ca767a55f6750c4f3e8b575134f5 (diff) |
fix importer for BTL
-rw-r--r-- | INFO | 2 | ||||
-rwxr-xr-x | rhautoimport-btl | 8 |
2 files changed, 7 insertions, 3 deletions
@@ -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]; |