diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-03 15:02:30 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-03 15:02:30 (GMT) |
commit | d2c6fec75ece949097f6e70abb527d90d6488a85 (patch) | |
tree | 243f66e808331800519835dfb43459426ffca026 /rhautoimport-eu | |
parent | f8e6b7f69fc217262b838ba812277e3d42fd6422 (diff) |
added importer for Economic Update
Diffstat (limited to 'rhautoimport-eu')
-rwxr-xr-x | rhautoimport-eu | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/rhautoimport-eu b/rhautoimport-eu index b79eff8..a8a57aa 100755 --- a/rhautoimport-eu +++ b/rhautoimport-eu @@ -23,6 +23,7 @@ use strict; use Date::Calc; +use DateTime::Format::ISO8601; use URI::URL; use HTML::Entities; @@ -81,7 +82,6 @@ if(Date::Calc::Delta_Days(@broadcast_date, @today) <= 0) { 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 after $bd in Audioboom Clips\n"; print " -> $API_URL\n"; @@ -109,9 +109,12 @@ for my $clip (@clips) { next unless $sum_title =~ /$titleexp/; my $recorded = $clip->{recorded_at}; - $recorded = '<unset>' unless (defined $recorded); - print " Title: $sum_title (Recorded: " . $recorded . ")\n"; - # TODO: check if recorded is after $bd + next unless (defined $recorded); + my $rdt = DateTime::Format::ISO8601->parse_datetime($recorded); + print " Title: $sum_title (Recorded: " . $rdt . ")\n"; + + my @recoreded_date = ($rdt->year, $rdt->month, $rdt->day); + next if(Date::Calc::Delta_Days(@broadcast_date, @recoreded_date) < 0); if (defined $clip->{description}) { $sum_text = decode_entities($clip->{description}); @@ -125,6 +128,7 @@ for my $clip (@clips) { my @path = $uri->path_components; $file = $path[-1]; + last } if($uri eq "") { print "No Entry found from $bd - "; |