diff options
author | Christian Pointner <equinox@helsinki.at> | 2012-06-06 13:17:03 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2012-06-06 13:17:03 (GMT) |
commit | cc9a70c6ea2e4dbf8e19205eae6f0cf4f1d23051 (patch) | |
tree | 90612ab5396890bfb955d268fb9c7d2da94beb59 /rhimport-fw | |
parent | 224c98d087048acb77c5c15db04ce97e5fc5fd51 (diff) |
fixed rhimport-fw for mondays
Diffstat (limited to 'rhimport-fw')
-rwxr-xr-x | rhimport-fw | 13 |
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; } |