summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2013-07-05 15:35:27 (GMT)
committerChristian Pointner <equinox@helsinki.at>2013-07-05 15:35:27 (GMT)
commitcfef01d110dd26a41dd0a2a09a32a47ab332802a (patch)
tree06529968c33dbf32785391524f0d4cd63a9f2ba9
parent16ee4cb9e02ec4dfaa98af4d440a5e3d394aadf8 (diff)
fixed note adder for zf and fe
-rwxr-xr-xrhimport-zffe18
1 files changed, 16 insertions, 2 deletions
diff --git a/rhimport-zffe b/rhimport-zffe
index ac55f46..fc34fc0 100755
--- a/rhimport-zffe
+++ b/rhimport-zffe
@@ -27,6 +27,7 @@ use Date::Calc;
use Time::localtime;
use IO::Handle;
use IPC::Open3;
+use File::Slurp;
use lib '/usr/local/share/rhimport/';
use rhimport;
@@ -46,7 +47,20 @@ if($#ARGV >= 0 && $ARGV[0] eq 'last') {
print "!!!This is the last attempt, there won't be a retry on error!!!\n"
}
-my @import_day = Date::Calc::Today();
+my @today = Date::Calc::Today();
+my $dow = Date::Calc::Day_of_Week(@today);
+my @tomorrow = Date::Calc::Add_Delta_Days($today[0], $today[1], $today[2], 1);
+
+my @tmp = Date::Calc::Standard_to_Business(@today);
+$tmp[2] = 1;
+my @this_mon = Date::Calc::Business_to_Standard(@tmp);
+my @next_mon = Date::Calc::Add_Delta_Days($this_mon[0], $this_mon[1], $this_mon[2], 7);
+
+my @import_day = @tomorrow;
+if ($dow == 5) {
+ @import_day = @next_mon;
+}
+
my $import_date = sprintf("%04d-%02d-%02d", @import_day);
my $current_date = `cat $STAT_FILE`;
if($current_date eq $import_date) {
@@ -86,7 +100,7 @@ sub get_note {
my $sum_title = "focus europa, zip-fm (WH)";
my $sum_text = get_note($FE_NOTE_FILE) . "<br/>\n";
-$sum_text = $sum_text . get_note($ZF_NOTE_FILE) . "<br/>\n";
+$sum_text = $sum_text . "<br/>\n" . get_note($ZF_NOTE_FILE) . "<br/>\n";
$sum_text = $sum_text . "<br/><br/>\n";
print "\nsummary:\n" . $sum_title . "\n\n" . $sum_text . "\n";