From 7ffd297bd4120690e45b7aa7d98f9c8472a1b3ec Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 13 Mar 2016 01:44:05 +0100 Subject: added external bounding checks to respective scripts diff --git a/rhautoimport-btl b/rhautoimport-btl index 77da585..87ad7c7 100755 --- a/rhautoimport-btl +++ b/rhautoimport-btl @@ -29,6 +29,7 @@ use XML::Feed::Content; use XML::Feed::Enclosure; use URI::URL; use HTML::Entities; +use RHRD::utils; use lib '/usr/local/share/rhautoimport/'; use rhautoimport; @@ -38,6 +39,12 @@ my $RSS_URL = "http://www.btlonline.org/rss/btl128.xml"; my $RD_GROUP = "betweenlin"; my $PV_ID = '221'; +my $curweek = RHRD::utils::get_rd_week(); +if($curweek == 2 || $curweek == 4) { + print "please don't run this script in week 2 or 4!\n"; + exit 42; +} + if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "!!!This is the last attempt, there won't be a retry on error!!!\n" } diff --git a/rhautoimport-oi b/rhautoimport-oi index f558c5e..a261055 100755 --- a/rhautoimport-oi +++ b/rhautoimport-oi @@ -29,6 +29,7 @@ use XML::Feed::Content; use XML::Feed::Enclosure; use URI::URL; use HTML::Entities; +use RHRD::utils; use lib '/usr/local/share/rhautoimport/'; use rhautoimport; @@ -39,6 +40,12 @@ my $RSS_URL = "http://npla.de/onda/feed/serie=3"; my $RD_GROUP = "ondainfo"; my $PV_ID = '220'; +my $curweek = RHRD::utils::get_rd_week(); +if($curweek == 1 || $curweek == 3) { + print "please don't run this script in week 1 or 3!\n"; + exit 42; +} + if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "!!!This is the last attempt, there won't be a retry on error!!!\n" } diff --git a/rhautoimport-rs b/rhautoimport-rs index 0dedf26..f525a6e 100755 --- a/rhautoimport-rs +++ b/rhautoimport-rs @@ -40,8 +40,20 @@ $XML::Feed::MULTIPLE_ENCLOSURES=1; my $RD_GROUP = "radioStimm"; my $PV_ID = '75'; -if($#ARGV >= 0 && $ARGV[0] eq 'last') { - print "!!!This is the last attempt, there won't be a retry on error!!!\n" +my $curweek = RHRD::utils::get_rd_week(); +my %week_table = ( 1 => 2, 2 => 6, 3 => 2, 4 => 6 ); +my $nextweek = $curweek == 4 ? 1 : $curweek + 1; + +if($#ARGV >= 0) { + if($curweek == 1 || $curweek == 3) { + if($ARGV[0] eq 'lastdi') { + print "!!!This is the last attempt, there won't be a retry on error!!!\n" + } + } else { + if($ARGV[0] eq 'lastsa') { + print "!!!This is the last attempt, there won't be a retry on error!!!\n" + } + } } @@ -65,10 +77,6 @@ if($show_id < 0) { } -my %week_table = ( 1 => 2, 2 => 6, 3 => 2, 4 => 6 ); -my $curweek = RHRD::utils::get_rd_week(); -my $nextweek = $curweek == 4 ? 1 : $curweek + 1; - my @today = Date::Calc::Today(); print "today: " . Date::Calc::Date_to_Text(@today) . "\n"; diff --git a/rhautoimport-tr b/rhautoimport-tr index f9e16b2..c604f9d 100755 --- a/rhautoimport-tr +++ b/rhautoimport-tr @@ -39,6 +39,12 @@ $XML::Feed::MULTIPLE_ENCLOSURES=1; my $RD_GROUP = "tierrecht"; my $PV_ID = '506'; +my @today = Date::Calc::Standard_to_Business(Date::Calc::Today()); +if($today[2] == 5) { + print "please don't run this script on fridays!\n"; + exit 42; +} + if($#ARGV >= 0 && $ARGV[0] eq 'last') { print "!!!This is the last attempt, there won't be a retry on error!!!\n" } @@ -58,11 +64,6 @@ my $show_id = $allowed_dbs[0]->{'SHOWID'}; my $show_title = $allowed_dbs[0]->{'SHOWTITLE'}; -my @today = Date::Calc::Standard_to_Business(Date::Calc::Today()); -if($today[2] == 5) { - print "please don't run this script on fridays!\n"; - exit 42; -} my @broadcast_day = Date::Calc::Business_to_Standard($today[0], $today[1], 5); if($today[2] < 5) { @broadcast_day = Date::Calc::Add_Delta_Days(@broadcast_day, -7); -- cgit v0.10.2