summaryrefslogtreecommitdiff
path: root/rhautoimport-dn
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-03-12 02:59:25 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2016-03-12 02:59:25 (GMT)
commitf6caff53c677882be78457589e2d48690472ac71 (patch)
tree4dc9811067cd4b115ed93998ab95b83b194da29a /rhautoimport-dn
parentef1f0ba590ba60d2f973851221fb2ead3d70011b (diff)
importer for democracy-now now uses rhimportd
Diffstat (limited to 'rhautoimport-dn')
-rwxr-xr-xrhautoimport-dn21
1 files changed, 9 insertions, 12 deletions
diff --git a/rhautoimport-dn b/rhautoimport-dn
index 61d68d1..693611c 100755
--- a/rhautoimport-dn
+++ b/rhautoimport-dn
@@ -78,9 +78,10 @@ if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
}
for my $href ( @allowed_dbs ) {
- if($href->{'TYPE'} eq "show" && $dow == $href->{'SHOWDOW'}) {
+ if($dow == $href->{'SHOWDOW'}) {
$show_title = $href->{'SHOWTITLE'};
$show_id = $href->{'SHOWID'};
+ last;
}
}
@@ -95,7 +96,7 @@ my $yc = sprintf("%04d-%02d%02d", $broadcast_day[0], $broadcast_day[1], $broadca
print "looking for files from date $y in RSS Feed\n";
print " -> $FILES_RSS_URL\n";
-my $files_feed = XML::Feed->parse(URI->new($FILES_RSS_URL))
+my $files_feed = rhautoimport::fetch_parse_rss($FILES_RSS_URL)
or die "Error fetching feed: " . XML::Feed->errstr;
my $uri = "";
@@ -138,7 +139,7 @@ unless($IGNORE_HEADLINE) {
print "\nlooking for headlines from date $y in RSS Feed\n";
print " -> $HEADLINES_RSS_URL\n";
- my $headlines_feed = XML::Feed->parse(URI->new($HEADLINES_RSS_URL))
+ my $headlines_feed = rhautoimport::fetch_parse_rss($HEADLINES_RSS_URL)
or die "Error fetching feed: " . XML::Feed->errstr;
for my $entry ($headlines_feed->entries) {
@@ -146,7 +147,7 @@ unless($IGNORE_HEADLINE) {
my $sum_title = $entry->title;
my $sum_text = $entry->summary->body . "\n<br />\n<a href=\"" . $entry->link . "\">" . $entry->link . "</a>\n";
- if($entry->id =~ /tag:democracynow.org,([0-9-]+):media\/mp3download\/[^\/]+/) {
+ if($entry->id =~ /tag:democracynow.org,([0-9-]+):media\/mp3podcast\/[^\/]+/) {
next if($y ne $1);
print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n";
@@ -171,18 +172,14 @@ unless($IGNORE_HEADLINE) {
print "will import '$uri' to show $show_id, $show_title\n\n";
-my ($ret, $log) = rhautoimport::clear_carts($show_id);
-$log = '' unless defined $log;
-if($ret == 0) {
- ($ret, my $import_log) = rhautoimport::import_uri($show_id, $uri);
- $log .= $import_log if defined $import_log;
-}
-
+my ($ret, $log) = rhautoimport::import_uri($show_id, $uri->as_string, "delete");
if($ret) {
- print "\nImport Error:\n";
+ print "\nImport Error:\n\n";
print $log;
exit 1;
}
+print "\nImport Success:\n\n";
+print $log;
unlink($STAT_FILE);
open(my $fhs, '>', $STAT_FILE);