summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrhimport-fw13
1 files changed, 11 insertions, 2 deletions
diff --git a/rhimport-fw b/rhimport-fw
index 35bedf7..7109198 100755
--- a/rhimport-fw
+++ b/rhimport-fw
@@ -87,9 +87,18 @@ my @import_date_reb = Date::Calc::Add_Delta_Days(@import_date, 4);
print "day of next broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
print "day of next rebroadcast: " . Date::Calc::Date_to_Text(@import_date_reb) . "\n";
+my $id = sprintf("%04d-%02d-%02d", @import_date);
my $bnum = `cat $LAST_FILE`;
$bnum += 1;
+my $current_stat = `cat $STAT_FILE`;
+my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/;
+if($current_id eq $id) {
+ print "Already downloaded current file\n";
+ $dbh->disconnect();
+ exit 0;
+}
+
print "looking for file with number $bnum in RSS Feed\n";
print " -> $RSS_URL\n";
@@ -124,7 +133,7 @@ for my $entry ($feed->entries) {
my $current_file = `cat $STAT_FILE`;
if($current_file eq $ff->output_file) {
- print "Already downloaded file of today\n";
+ print "Already downloaded current file\n";
$dbh->disconnect();
exit 0;
}
@@ -191,7 +200,7 @@ if(!$ret) {
unlink($STAT_FILE);
open(my $fhs, '>', $STAT_FILE);
-print $fhs $out_file;
+print $fhs "$id\n$out_file";
close($fhs);
unlink($LAST_FILE);