From d2c6fec75ece949097f6e70abb527d90d6488a85 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 3 Jun 2016 17:02:30 +0200 Subject: added importer for Economic Update diff --git a/Makefile b/Makefile index 8d1eec1..0caf316 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ endif .PHONY: clean distclean EXECUTABLE := rhautoimport -IMPORTER := btl dn er nw oi po rs ra tr wr +IMPORTER := btl dn er eu nw oi po rs ra tr wr EXECUTABLES := $(IMPORTER:%=$(EXECUTABLE)-%) all: $(EXECUTABLE) diff --git a/debian/changelog b/debian/changelog index 97b239a..aeb5199 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,15 @@ +rhautoimport (13-1) unstable; urgency=medium + + * added importer Economic Update + + -- Christian Pointner Fri, 03 Jun 2016 16:58:23 +0200 + rhautoimport (12-1) unstable; urgency=medium * added importer for Panoptikum * fixed some minor bugs for Ergo and Werkstatt-Radio - -- Christian Pointner Thu, 02 Jun 2016 14:52:25 +0200 + -- Christian Pointner Thu, 02 Jun 2016 14:52:25 +0200 rhautoimport (11-1) unstable; urgency=medium diff --git a/debian/control b/debian/control index 937c0fd..873412d 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.5 Package: rhautoimport Architecture: all -Depends: ${misc:Depends}, adduser, libdate-calc-perl, libdatetime-format-strptime-perl, libfile-slurp-perl, libjson-maybexs-perl, librhrd-perl, liburi-perl, libwww-perl, libxml-feed-perl, perl, bsd-mailx +Depends: ${misc:Depends}, adduser, libdate-calc-perl, libdatetime-format-strptime-perl, libdatetime-format-iso8601-perl, libfile-slurp-perl, libjson-maybexs-perl, librhrd-perl, liburi-perl, libwww-perl, libxml-feed-perl, perl, bsd-mailx Description: Radio Helsinki automatic importer This a set of scripts to automagically import shows from various external sources. diff --git a/rhautoimport b/rhautoimport index b008a13..e1ac820 100755 --- a/rhautoimport +++ b/rhautoimport @@ -37,6 +37,9 @@ case "$1" in er) TITLE="Ergo" ;; + eu) + TITLE="Economic Update" + ;; nw) TITLE="netwatcher" ;; 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 = '' 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 - "; -- cgit v0.10.2