summaryrefslogtreecommitdiff
path: root/rhimport-fw
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport-fw')
-rwxr-xr-xrhimport-fw13
1 files changed, 7 insertions, 6 deletions
diff --git a/rhimport-fw b/rhimport-fw
index 32d8d99..d781b6c 100755
--- a/rhimport-fw
+++ b/rhimport-fw
@@ -60,13 +60,14 @@ my $dropbox = "";
my $to_cart = 0;
my @today = Date::Calc::Today();
-my @yesterday = Date::Calc::Add_Delta_Days($today[0], $today[1], $today[2], -1);
+my $dow = Date::Calc::Day_of_Week(@today);
+my @broadcastday = Date::Calc::Add_Delta_Days($today[0], $today[1], $today[2], -1);
+@broadcastday = Date::Calc::Add_Delta_Days($today[0], $today[1], $today[2], -3) if $dow == 1;
print "today: " . Date::Calc::Date_to_Text(@today) . "\n";
-print "yesterday: " . Date::Calc::Date_to_Text(@yesterday) . "\n";
+print "day of original broadcast: " . Date::Calc::Date_to_Text(@broadcastday) . "\n";
for my $href ( @allowed_dbs ) {
- my $dow = Date::Calc::Day_of_Week(@today);
if ($dow == int(substr($href->{'NAME'},0,2))) {
$dropbox = $href->{'PATH'};
$to_cart = $href->{'TO_CART'};
@@ -80,8 +81,8 @@ if($dropbox eq "") {
}
-my $regexp = sprintf("%04d%02d%02dfrontex\\.mp3\$", $yesterday[0], $yesterday[1], $yesterday[2]);
-print "looking for file from " . Date::Calc::Date_to_Text(@yesterday) . " in RSS Feed\n";
+my $regexp = sprintf("%04d%02d%02dfrontex\\.mp3\$", $broadcastday[0], $broadcastday[1], $broadcastday[2]);
+print "looking for file from " . Date::Calc::Date_to_Text(@broadcastday) . " in RSS Feed\n";
my $feed = XML::Feed->parse(URI->new($RSS_URL))
or die "Error fetching feed: " . XML::Feed->errstr;
@@ -117,7 +118,7 @@ for my $entry ($feed->entries) {
}
}
if($file eq "" || !(-e "$file")) {
- print "No Entry found for " . Date::Calc::Date_to_Text(@yesterday) . " or download error - will retry later\n";
+ print "No Entry found for " . Date::Calc::Date_to_Text(@broadcastday) . " or download error - will retry later\n";
exit 1;
}