summaryrefslogtreecommitdiff
path: root/rhautoimport-wr
diff options
context:
space:
mode:
Diffstat (limited to 'rhautoimport-wr')
-rwxr-xr-xrhautoimport-wr33
1 files changed, 16 insertions, 17 deletions
diff --git a/rhautoimport-wr b/rhautoimport-wr
index 457d068..a5ece8b 100755
--- a/rhautoimport-wr
+++ b/rhautoimport-wr
@@ -59,6 +59,20 @@ if($curweek == 1 || $curweek == 3) {
rhautoimport::report_title_and_last($TITLE, $LAST_RUN);
+my @allowed_dbs = rhautoimport::get_dropboxes($RD_GROUP);
+if(!defined $allowed_dbs[0] && defined $allowed_dbs[1]) {
+ print "$allowed_dbs[1]\n";
+ exit 1;
+}
+
+if(scalar(@allowed_dbs) != 1) {
+ print "found more or less than one Dropbox for this group?!\n";
+ exit 1;
+}
+my $show_id = $allowed_dbs[0]->{'SHOWID'};
+my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
+
+
my @today = Date::Calc::Today();
print "today: " . Date::Calc::Date_to_Text(@today) . " (Week: " . $curweek . ")\n";
@@ -74,27 +88,12 @@ if($curweek == 1 || $curweek == 3) {
} else {
@import_date = Date::Calc::Add_Delta_Days(@import_date, 7);
}
-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;
-}
-
-if(scalar(@allowed_dbs) != 1) {
- print "found more or less than one Dropbox for this group?!\n";
- exit 1;
-}
-my $show_id = $allowed_dbs[0]->{'SHOWID'};
-my $show_title = $allowed_dbs[0]->{'SHOWTITLE'};
-
my @broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($import_date[0], $import_date[1], 1, 3);
if(Date::Calc::Delta_Days(@broadcast_date, @import_date) <= 0) {
my @tmp_date = Date::Calc::Add_Delta_YM(@broadcast_date, 0, -1);
@broadcast_date = Date::Calc::Nth_Weekday_of_Month_Year($tmp_date[0], $tmp_date[1], 1, 3);
}
+print "day of next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@import_date) . "\n";
print "day of latest original broadcast before next Radio Helsinki broadcast: " . Date::Calc::Date_to_Text(@broadcast_date) . "\n";
if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
@@ -105,7 +104,7 @@ if(Date::Calc::Delta_Days(@broadcast_date, @today) <= $upload_delay_days) {
my $id = sprintf("%04d-%02d-%02d", @import_date);
my $bd = sprintf("%04d-%02d-%02d", @broadcast_date);
-print "looking for files for broadcast date $bd in RSS Feed\n";
+print "looking for files with cba:broadcastDate $bd in RSS Feed\n";
print " -> $RSS_URL\n";
my ($result, $feed) = rhautoimport::fetch_parse_rss_cba($RSS_URL);