diff options
Diffstat (limited to 'rhimport-er')
-rwxr-xr-x | rhimport-er | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/rhimport-er b/rhimport-er index 7b1e52f..a91cf04 100755 --- a/rhimport-er +++ b/rhimport-er @@ -45,13 +45,19 @@ my $STAT_FILE = $ENV{'HOME'} . "/rhimport-er.stat"; my $LAST_FILE = $ENV{'HOME'} . "/rhimport-er.last"; my $RSS_URL = "https://cba.fro.at/series/ergo/feed?c=Kfs2IoV2Wmd"; my $PV_ID = '569'; +my $LAST_RUN = 0; binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); -if($#ARGV >= 0 && $ARGV[0] eq 'last') { - print "!!!This is the last attempt, there won't be a retry on error!!!\n" +my $curweek = rhimport::get_rd_week(); + +if($curweek == 1 || $curweek == 3) { + if($#ARGV >= 0 && $ARGV[0] eq 'last') { + print "!!!This is the last attempt, there won't be a retry on error!!!\n"; + $LAST_RUN = 1; + } } my $user = `/usr/bin/id -un`; @@ -69,8 +75,6 @@ if(scalar(@allowed_dbs) != 1) { my $dropbox = $allowed_dbs[0]->{'PATH'}; my $to_cart = $allowed_dbs[0]->{'TO_CART'}; -my $curweek = rhimport::get_rd_week(); - my @today = Date::Calc::Today(); my @import_date = Date::Calc::Standard_to_Business(@today); $import_date[2] = 5; @@ -127,7 +131,6 @@ for my $entry ($feed->entries) { my $sum_title = decode_entities($entry->title); next unless $sum_title =~ /$bdnumexp/; - my $sum_text = decode_entities($entry->content->body); if($max_broadcast_num < $1) { $max_broadcast_num = $1; @@ -150,11 +153,6 @@ for my $entry ($feed->entries) { die "wget returned with error: " . $!; } print "ok\n"; - - print "summary:\n" . $sum_title . "\n\n" . $sum_text . "\n"; - - rhimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1"); - last; } } @@ -162,7 +160,7 @@ for my $entry ($feed->entries) { } if($file eq "" || !(-e "$file")) { print "No Entry found for #$broadcast_num or download error - "; - if($#ARGV >= 0 && $ARGV[0] eq 'last') { + if($LAST_RUN) { print "giving up, manual import necessary!!!\n"; } else { print "will retry later\n"; |