diff options
Diffstat (limited to 'rhimport-wr')
-rwxr-xr-x | rhimport-wr | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/rhimport-wr b/rhimport-wr index 89c0b54..2fd1089 100755 --- a/rhimport-wr +++ b/rhimport-wr @@ -47,13 +47,20 @@ my $STAT_FILE = $ENV{'HOME'} . "/rhimport-wr.stat"; my $RSS_URL = "https://cba.fro.at/series/werkstatt-radio/feed?c=Kfs2IoV2Wmd"; $XML::Feed::MULTIPLE_ENCLOSURES=1; my $PV_ID = '567'; +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`; @@ -72,7 +79,6 @@ if(scalar(@allowed_dbs) != 1) { my $dropbox = $allowed_dbs[$idx]->{'PATH'}; my $to_cart = $allowed_dbs[$idx]->{'TO_CART'}; -my $curweek = rhimport::get_rd_week(); my @today = Date::Calc::Today(); print "today: " . Date::Calc::Date_to_Text(@today) . " (Week: " . $curweek . ")\n"; @@ -137,9 +143,6 @@ for my $entry ($feed->entries) { my $url = new URI::URL($fetchurl); my @path = $url->path_components; - my $sum_title = decode_entities($entry->title); - my $sum_text = decode_entities($entry->content->body); - my $current_stat = `cat $STAT_FILE`; my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/; if($current_id eq $id && $current_file eq $path[-1]) { @@ -162,11 +165,6 @@ for my $entry ($feed->entries) { } 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"); - print "\n"; - last; } } @@ -175,7 +173,7 @@ for my $entry ($feed->entries) { if($file eq "" || !(-e "$file")) { print "No Entry found from $bd 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"; |