From 2124e208d8f5279626fa1d2a8318d5fbc82a82d0 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 12 Jun 2017 10:40:36 +0200 Subject: fix women on-air importer 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) { -- cgit v0.10.2