diff options
-rwxr-xr-x | rhautoimport-gd | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/rhautoimport-gd b/rhautoimport-gd index cc9256f..2bacb53 100755 --- a/rhautoimport-gd +++ b/rhautoimport-gd @@ -71,8 +71,16 @@ my $show_title_reb = $allowed_dbs[$idx_reb]->{'SHOWTITLE'}; my @today = Date::Calc::Standard_to_Business(Date::Calc::Today()); +my $dow = $today[2]; +if($dow > 1 && $dow < 5) { + print "please don't run this script Tuesday, Wednesday or Thursday!\n"; + exit 42; +} $today[2] = 2; my @broadcast_day = Date::Calc::Business_to_Standard(@today); +if($dow == 1) { + @broadcast_day = Date::Calc::Add_Delta_Days(@broadcast_day, -7); +} my @import_date = Date::Calc::Add_Delta_Days(@broadcast_day, 6); my @import_date_reb = Date::Calc::Add_Delta_Days(@import_date, 3); print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_day) . "\n"; @@ -113,7 +121,10 @@ for my $entry ($feed->entries) { $uri = new URI::URL($orig_uri); my @path = $uri->path_components; $file = $path[-1]; - next unless $file =~ /$bdexp/; + unless($file =~ /$bdexp/) { + $uri = ""; + next; + } my $current_file = `cat $STAT_FILE`; if($current_file eq $file) { |