summaryrefslogtreecommitdiff
path: root/rhautoimport-rs
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-15 02:06:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-15 02:06:08 (GMT)
commit818a2dc4bacbe6f0e63386942f2a5111fcca1341 (patch)
tree9ef21eb11c077389e03efd8881c880ca97f89c50 /rhautoimport-rs
parent165b76ae2072b5cad1dde22b0896c6c3fd54815e (diff)
fixed permissions for request file, selection of right radio stimme show-id works now
Diffstat (limited to 'rhautoimport-rs')
-rwxr-xr-xrhautoimport-rs45
1 files changed, 24 insertions, 21 deletions
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);