summaryrefslogtreecommitdiff
path: root/rhautoimport-ra
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2023-05-31 08:23:26 (GMT)
committerChristian Pointner <equinox@helsinki.at>2023-05-31 08:23:26 (GMT)
commite34f35c083bbf377b08f0257e66c1391bfd306f5 (patch)
tree9655de97ea8eff462bb6cbc83dd668dd4623fdd3 /rhautoimport-ra
parent54397eac390b5af017f4a86232a3a839ea56831a (diff)
radio-attac has been moved to monday
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";