summaryrefslogtreecommitdiff
path: root/rhautoimport-eu
diff options
context:
space:
mode:
Diffstat (limited to 'rhautoimport-eu')
-rwxr-xr-xrhautoimport-eu12
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 - ";