From 9a1a9a985214b849ae24c3b0c927be35f003f6ed Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 20 Jul 2011 23:37:42 +0000 Subject: first version for PV note adding git-svn-id: https://svn.helsinki.at/rhimport/trunk@81 7c65635b-ec39-4f67-a626-873dbafdd612 diff --git a/rhimport-dn b/rhimport-dn index 644f729..c017d26 100755 --- a/rhimport-dn +++ b/rhimport-dn @@ -38,6 +38,9 @@ my $DBUSER = "rivendell"; my $DBPW = "lldriven"; my $DB = "rivendell"; +my $RSS_URL = "http://www.democracynow.org/podcast.xml"; +my $PV_SCRIPT = "/usr/bin/ssh"; +my @PV_SCRIPT_ARGS = ('root@intranet', 'addnote', '111'); my $user = `/usr/bin/id -un`; $user =~ s/\n//; @@ -74,7 +77,7 @@ if($dropbox eq "") { my $y = sprintf("%04d-%02d-%02d", $yesterday[0], $yesterday[1], $yesterday[2]); print "looking for files from date $y in RSS Feed\n"; -my $feed = XML::Feed->parse(URI->new('http://www.democracynow.org/podcast.xml')) +my $feed = XML::Feed->parse(URI->new($RSS_URL)) or die "Error fetching feed: " . XML::Feed->errstr; my $file = ""; @@ -88,10 +91,21 @@ for my $entry ($feed->entries) { my $ff = File::Fetch->new(uri => $entry->enclosure->url); print $1 . ": downloading " . $entry->enclosure->url . " (" . $entry->enclosure->length . " Bytes) .. "; - $file = $ff->fetch( to => '/tmp' ) or die $ff->error; + $file = "test"; #$ff->fetch( to => '/tmp' ) or die $ff->error; print "ok\n"; print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n"; + + push(@PV_SCRIPT_ARGS, sprintf("%04d-%02d-%02d", $today[0], $today[1], $today[2])); + push(@PV_SCRIPT_ARGS, $sum_title); + push(@PV_SCRIPT_ARGS, $sum_text); + system($PV_SCRIPT, @PV_SCRIPT_ARGS); + if($? eq 0) { + print "PV: note added successfully"; + } + else { + print "PV: adding note failed"; + } } print "\n"; } -- cgit v0.10.2