summaryrefslogtreecommitdiff
path: root/rhimport-fw
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport-fw')
-rwxr-xr-xrhimport-fw19
1 files changed, 12 insertions, 7 deletions
diff --git a/rhimport-fw b/rhimport-fw
index 148ed18..ef8b159 100755
--- a/rhimport-fw
+++ b/rhimport-fw
@@ -31,6 +31,7 @@ use File::Fetch;
use IO::Handle;
use IPC::Open3;
use HTML::Entities;
+use RHRD::rddb;
use lib '/usr/local/share/rhimport/';
use rhimport;
@@ -53,18 +54,22 @@ my $user = `/usr/bin/id -un`;
$user =~ s/\n//;
my $group = "freiewelle";
-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 $idx = 0;
my $idx_reb = 1;
if(scalar(@allowed_dbs) != 2) {
print "found more or less than 2 Dropboxes for this group?!\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 1;
}
my $dropbox = $allowed_dbs[$idx]->{'PATH'};
@@ -93,7 +98,7 @@ my $current_stat = `cat $STAT_FILE`;
my ($current_id, $current_file) = $current_stat =~ m/^(.*)\n(.*)/;
if($current_id eq $id) {
print "Already downloaded current file\n";
- rhimport::closedb($dbh);
+ RHRD::rddb::closedb($dbh);
exit 0;
}
@@ -132,13 +137,13 @@ for my $entry ($feed->entries) {
my $current_file = `cat $STAT_FILE`;
if($current_file eq $ff->output_file) {
print "Already downloaded current file\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;
}
@@ -191,7 +196,7 @@ $log .= $import_log;
($ret, $import_log) = rhimport::import_single($file, $dropbox_reb, $user, 0, $error_cb);
$log .= $import_log;
-rhimport::closedb($dbh);
+RHRD::rddb::closedb($dbh);
unlink $file;