summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-07-20 23:37:42 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-07-20 23:37:42 (GMT)
commit70dc9957ce90ef0b77fe2a497d90ad3ccf050712 (patch)
tree30fe9fca49b50ae7059436f9f454c98f61537de1
parent5b2e7e91ebbab005e9a8dc69c603402e7fdc6a32 (diff)
first version for PV note adding
-rwxr-xr-xrhimport-dn18
1 files changed, 16 insertions, 2 deletions
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";
}