summaryrefslogtreecommitdiff
path: root/rhautoimport-ra
diff options
context:
space:
mode:
Diffstat (limited to 'rhautoimport-ra')
-rwxr-xr-xrhautoimport-ra15
1 files changed, 10 insertions, 5 deletions
diff --git a/rhautoimport-ra b/rhautoimport-ra
index b72c5d7..6874e34 100755
--- a/rhautoimport-ra
+++ b/rhautoimport-ra
@@ -24,6 +24,7 @@
use strict;
use Date::Calc;
use DateTime::Format::Strptime;
+use Time::localtime;
use XML::Feed;
use XML::Feed::Entry;
use XML::Feed::Content;
@@ -69,11 +70,15 @@ my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
my @today = Date::Calc::Today();
-my @tmp = Date::Calc::Standard_to_Business(@today);
-$tmp[2] = 1;
-my @broadcast_date = Date::Calc::Business_to_Standard(@tmp);
-$tmp[2] = 6;
-my @import_date = Date::Calc::Business_to_Standard(@tmp);
+my $dow = Date::Calc::Day_of_Week(@today);
+my @import_date = @today;
+if($dow != 1 || localtime->hour >= 13) {
+ @import_date = Date::Calc::Standard_to_Business(@today);
+ $import_date[2] = 1;
+ @import_date = Date::Calc::Business_to_Standard(@import_date);
+ @import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
+}
+my @broadcast_date = Date::Calc::Add_Delta_Days(@import_date, -7);
print "today: " . Date::Calc::Date_to_Text(@today) . "\n";
print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n";