summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrhautoimport-btl1
-rwxr-xr-xrhautoimport-dn1
-rwxr-xr-xrhautoimport-nw1
-rwxr-xr-xrhautoimport-oi1
-rwxr-xr-xrhautoimport-ra2
-rwxr-xr-xrhautoimport-rs45
-rwxr-xr-xrhautoimport-tr1
-rw-r--r--rhautoimport.pm1
8 files changed, 32 insertions, 21 deletions
diff --git a/rhautoimport-btl b/rhautoimport-btl
index 1e2e7cc..d50873e 100755
--- a/rhautoimport-btl
+++ b/rhautoimport-btl
@@ -141,6 +141,7 @@ if($ret) {
}
print "\nImport Success:\n\n";
print $log;
+print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1");
unlink($STAT_FILE);
diff --git a/rhautoimport-dn b/rhautoimport-dn
index 2a65c8b..62ba332 100755
--- a/rhautoimport-dn
+++ b/rhautoimport-dn
@@ -164,6 +164,7 @@ if($ret) {
print "\nImport Success:\n\n";
print $log;
if($sum_title ne "") {
+ print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_day), "1", 0);
}
diff --git a/rhautoimport-nw b/rhautoimport-nw
index e3f3dad..d2168f2 100755
--- a/rhautoimport-nw
+++ b/rhautoimport-nw
@@ -149,6 +149,7 @@ if($ret) {
}
print "\nImport Success:\n\n";
print $log;
+print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1");
unlink($STAT_FILE);
diff --git a/rhautoimport-oi b/rhautoimport-oi
index ac3ea89..dad499b 100755
--- a/rhautoimport-oi
+++ b/rhautoimport-oi
@@ -142,6 +142,7 @@ if($ret) {
}
print "\nImport Success:\n\n";
print $log;
+print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1");
unlink($STAT_FILE);
diff --git a/rhautoimport-ra b/rhautoimport-ra
index 0710a62..ff95bcc 100755
--- a/rhautoimport-ra
+++ b/rhautoimport-ra
@@ -146,6 +146,7 @@ my ($ret, $log, $keptfile_uri) = rhautoimport::import_uri($show_id, $uri->as_str
if($ret == 0) {
print "\nImport Success:\n\n";
print $log;
+ print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date), "1");
print "\n";
@@ -160,6 +161,7 @@ if($ret == 0) {
if($ret == 0) {
print "\nImport Success:\n\n";
print $log;
+ print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, sprintf("%04d-%02d-%02d", @import_date_reb), "2");
} else {
print "\nImport Error:\n\n";
diff --git a/rhautoimport-rs b/rhautoimport-rs
index 75eac79..8143977 100755
--- a/rhautoimport-rs
+++ b/rhautoimport-rs
@@ -59,27 +59,6 @@ if($#ARGV >= 0) {
}
}
-
-my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
-if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
- print "$allowed_dbs[1]\n";
- exit 1;
-}
-
-my $show_id = -1;
-my $show_title = "";
-foreach(@allowed_dbs) {
- if($_->{'NAME'} =~ /^autoimport/) { # TODO: this needs to be done differently!!!
- $show_id = $_->{'SHOWID'};
- $show_title = $_->{'SHOWTITLE'};
- }
-}
-if($show_id < 0) {
- print "no dropbox found!\n";
- exit 1;
-}
-
-
my @today = Date::Calc::Today();
print "today: " . Date::Calc::Date_to_Text(@today) . "\n";
@@ -90,15 +69,38 @@ if($dow <= $week_table{$curweek}) {
print "We are in week $curweek - broadcast is on " . Date::Calc::Day_of_Week_to_Text($week_table{$curweek}) . "\n";
$import_date[2] = $week_table{$curweek};
@import_date = Date::Calc::Business_to_Standard(@import_date);
+ $dow = $week_table{$curweek};
} else {
print "We are in week $curweek - broadcast was on " . Date::Calc::Day_of_Week_to_Text($week_table{$curweek}) . "\n";
print " next week is $nextweek - broadcast is on " . Date::Calc::Day_of_Week_to_Text($week_table{$nextweek}) . "\n";
$import_date[2] = $week_table{$nextweek};
@import_date = Date::Calc::Business_to_Standard(@import_date);
@import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
+ $dow = $week_table{$curweek};
}
print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
+
+my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
+if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
+ print "$allowed_dbs[1]\n";
+ exit 1;
+}
+
+my $show_id = -1;
+my $show_title = "";
+foreach(@allowed_dbs) {
+ if($_->{'SHOWDOW'} == $dow) {
+ $show_id = $_->{'SHOWID'};
+ $show_title = $_->{'SHOWTITLE'};
+ last
+ }
+}
+if($show_id < 0) {
+ print "no dropbox found!\n";
+ exit 1;
+}
+
my @broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 2, 1);
if(Date::Calc::Delta_Days(@broadcast_date, @import_date) > 0) {
my @tmp_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 2, 3);
@@ -193,6 +195,7 @@ if($ret) {
}
print "\nImport Success:\n\n";
print $log;
+print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1");
unlink($STAT_FILE);
diff --git a/rhautoimport-tr b/rhautoimport-tr
index 488c5ed..8f38839 100755
--- a/rhautoimport-tr
+++ b/rhautoimport-tr
@@ -149,6 +149,7 @@ if($ret) {
}
print "\nImport Success:\n\n";
print $log;
+print "\n";
rhautoimport::pv_add_note($sum_title, $sum_text, $PV_ID, $id, "1");
unlink($STAT_FILE);
diff --git a/rhautoimport.pm b/rhautoimport.pm
index a0684ce..97d6429 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -157,6 +157,7 @@ sub import_uri
SUFFIX => '.new');
return (1, "can't create request file in watchdir\n") unless($fh);
+ chmod(0660, $fh);
my $requestfile = $fh->filename;
my $log = "request file written to '$requestfile' ... ";
print $fh to_json(\%request);