diff options
Diffstat (limited to 'rhautoimport-btl')
-rwxr-xr-x | rhautoimport-btl | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/rhautoimport-btl b/rhautoimport-btl index a67d432..3fd662d 100755 --- a/rhautoimport-btl +++ b/rhautoimport-btl @@ -40,6 +40,7 @@ my $RD_GROUP = "betweenlin"; my $PV_ID = '221'; my $TITLE="Between the Lines"; my $LAST_RUN = 0; +my $upload_delay_days = 0; # files are usally there on the same day binmode(STDIN, ":utf8"); binmode(STDOUT, ":utf8"); @@ -47,7 +48,7 @@ binmode(STDERR, ":utf8"); 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"; + print "won't do anything in week 2 or 4!\n"; rhautoimport::report_title_and_last($TITLE, 0); exit 42; } @@ -72,20 +73,22 @@ if(scalar(@allowed_dbs) != 1) { my $show_id = $allowed_dbs[0]->{'SHOWID'}; my $show_title = $allowed_dbs[0]->{'SHOWTITLE'}; - my @today = Date::Calc::Today(); my @import_date = Date::Calc::Add_Delta_Days(@today, 7); @import_date = Date::Calc::Standard_to_Business(@import_date); $import_date[2] = 1; -my @broadcast_date = @import_date; -$broadcast_date[2] = 5; - @import_date = Date::Calc::Business_to_Standard(@import_date); -@broadcast_date = Date::Calc::Business_to_Standard(@broadcast_date); + +my @broadcast_date = Date::Calc::Add_Delta_Days(@import_date, -5); print "today: " . Date::Calc::Date_to_Text(@today) . "\n"; print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n"; -print "ending of current broadcast cycle: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n"; +print "current broadcast cycle starts/started on: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n"; + +if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) { + print "File won't be available by now!\n"; + exit 42; +} my $id = sprintf("%04d-%02d-%02d", @import_date); my $bd = sprintf("%04d-%02d-%02d", @broadcast_date); |