summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-07-22 11:23:01 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-07-22 11:23:01 (GMT)
commit6418c2c469db7df7f8a83990017b0c9e3020f359 (patch)
treea91f2c7b522e05c0b2b90538144a6304e2ae0818
parentb44097e9249a69474b67540a27a58c8987607141 (diff)
added stat_file check to rhimport-dn
-rw-r--r--debian/changelog8
-rw-r--r--debian/control2
-rwxr-xr-xrhimport-dn28
3 files changed, 27 insertions, 11 deletions
diff --git a/debian/changelog b/debian/changelog
index 8593753..0928695 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
+rhimport (0.3.2-1) unstable; urgency=low
+
+ * new upstream release 0.3.2
+
+ -- Christian Pointner <equinox@helsinki.at> Fri, 22 Jul 2011 13:22:12 +0200
+
rhimport (0.3.1-1) unstable; urgency=low
* new upstream release 0.3.1
- -- Christian Pointner <equinox@helsinki.at> Fri, 21 Jul 2011 17:48:24 +0200
+ -- Christian Pointner <equinox@helsinki.at> Thu, 21 Jul 2011 17:48:24 +0200
rhimport (0.3-1) unstable; urgency=low
diff --git a/debian/control b/debian/control
index aa4b7a1..53e18c1 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://www.helsinki.at/
Package: rhimport
Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, perl, libdbd-mysql-perl, libgtk2-gladexml-perl, libdate-calc-perl, libxml-feed-perl
+Depends: ${misc:Depends}, adduser, perl, libdbd-mysql-perl, libgtk2-gladexml-perl, libdate-calc-perl, libxml-feed-perl
Description: Radio Helsinki Import Tool
rhimport is a small tool which can be used to import media files
into the playout system namley Rivendell.
diff --git a/rhimport-dn b/rhimport-dn
index 0b95049..ca7d4b2 100755
--- a/rhimport-dn
+++ b/rhimport-dn
@@ -40,6 +40,7 @@ my $DBUSER = "rivendell";
my $DBPW = "lldriven";
my $DB = "rivendell";
+my $STAT_FILE = $ENV{'HOME'} . "/rhimport-dn.stat";
my $RSS_URL = "http://www.democracynow.org/podcast.xml";
my @PV_SCRIPT = ('/usr/bin/ssh', 'root@intranet', 'addnote', '111');
@@ -89,8 +90,20 @@ for my $entry ($feed->entries) {
if($entry->id =~ /tag:democracynow.org,([0-9-]+):media\/mp3download\/[^\/]+/) {
next if($y ne $1);
-
+
my $ff = File::Fetch->new(uri => $entry->enclosure->url);
+
+ my $current_file = `cat $STAT_FILE`;
+ if($current_file eq $ff->output_file) {
+ print "Already downloaded file of today\n";
+ $dbh->disconnect();
+ exit 0;
+ }
+ unlink($STAT_FILE);
+ open(my $fhs, '>', $STAT_FILE);
+ print $fhs $ff->output_file;
+ close($fhs);
+
print $1 . ": downloading " . $entry->enclosure->url . " (" . $entry->enclosure->length . " Bytes) .. ";
$file = $ff->fetch( to => '/tmp' ) or die $ff->error;
print "ok\n";
@@ -105,16 +118,13 @@ for my $entry ($feed->entries) {
print $writer $sum_title . "\n" . $sum_text;
close $writer;
waitpid $pid, 0;
- my $out = join('', <$reader>);
- my $errstr = "";
if ( $? >> 8 ) {
- $errstr = join('', <$error>);
- print "PV: adding note failed";
- print "STDERR:\n" . $errstr . "\n\n";
- print "STDOUT:\n" . $out . "\n\n";
+ print "\n\nPV: adding note failed\n";
+ print "STDERR:\n" . join('', <$error>) . "\n";
+ print "STDOUT:\n" . join('', <$reader>) . "\n";
} else {
- print "PV: note added successfully";
- print $out . "\n";
+ print "\nPV: note added successfully";
+ print join('', <$reader>) . "\n";
}
}
print "\n";