summaryrefslogtreecommitdiff
path: root/rhimport-rs
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport-rs')
-rwxr-xr-xrhimport-rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/rhimport-rs b/rhimport-rs
index f5bce9b..808d36c 100755
--- a/rhimport-rs
+++ b/rhimport-rs
@@ -32,6 +32,7 @@ use IO::Handle;
use IPC::Open3;
use HTML::Entities;
use LWP::Simple;
+use RHRD::rddb;
use lib '/usr/local/share/rhimport/';
use rhimport;
@@ -54,12 +55,16 @@ $user =~ s/\n//;
my $group = "radioStimm";
my %week_table = ( 1 => 2, 2 => 6, 3 => 2, 4 => 6 );
-my ($dbh, $errorstring) = rhimport::opendb();
+my ($dbh, $errorstring) = RHRD::rddb::opendb();
if(!defined $dbh) {
print "$errorstring\n";
exit 1;
}
-my @allowed_dbs = rhimport::get_dropboxes($dbh, $user, $group);
+my @allowed_dbs = RHRD::rddb::get_dropboxes($dbh, $user, $group);
+if(!defined $allowed_dbs[0] && defined $allowed_dbs[2]) {
+ print "$allowed_dbs[2]\n";
+ exit 1;
+}
my $dropbox = "";
my $to_cart = 0;
@@ -71,7 +76,7 @@ foreach(@allowed_dbs) {
}
if(!$to_cart) {
print "no dropbox found!\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 1;
}
@@ -111,7 +116,7 @@ print "day of latest original broadcast before next Radio Helsinki broadcast: "
if(Date::Calc::Delta_Days(@broadcast_date, @today) <= 0) {
print "File won't be available by now!\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 0;
}
@@ -151,13 +156,13 @@ for my $entry ($feed->entries) {
my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/;
if($current_id eq $id && $current_file eq $ff->output_file) {
print "Already downloaded file of today\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 0;
}
$out_file = $ff->output_file;
if(!rhimport::check_file_extension($out_file)) {
print "\n\nThe extension of the matching file '". $out_file . "' seems to be wrong - manual import necessary!!!\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 1;
}
@@ -203,7 +208,7 @@ my $import_log;
($ret, $import_log) = rhimport::import_single($file, $dropbox, $user, 0, $error_cb);
$log .= $import_log;
-rhimport::closedb($dbh);
+RHRD::rddb::closedb($dbh);
unlink $file;