summaryrefslogtreecommitdiff
path: root/rhimport.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport.pm')
-rw-r--r--rhimport.pm20
1 files changed, 15 insertions, 5 deletions
diff --git a/rhimport.pm b/rhimport.pm
index c970bcf..2d2f190 100644
--- a/rhimport.pm
+++ b/rhimport.pm
@@ -33,7 +33,7 @@ my $ssh_host = "airplay";
my $ssh_user = "rhimport";
my $ssh_key_file = "id_dsa";
my $ssh_dir = "/programm/.rhimport";
-my $rdimport_wrapper = "/usr/local/bin/dropbox_newfile.pl";
+my $rdimport_wrapper = "/usr/local/bin/dropbox_newfile.pl1";
sub get_dropboxes
{
@@ -102,7 +102,7 @@ sub get_used_carts
sub clear_carts
{
- my ($dbh, $group, $to_cart) = @_;
+ my ($dbh, $group, $to_cart, $progress_cb) = @_;
my ($low_cart, $high_cart) = ($to_cart, $to_cart);
if($to_cart == 0) {
@@ -112,6 +112,8 @@ sub clear_carts
print "clearing Carts $low_cart - $high_cart\n";
my $cart = $low_cart;
while($cart <= $high_cart) {
+ $progress_cb->($cart - $low_cart, $high_cart + 1 - $low_cart, "deleting $cart") if($progress_cb);
+
my $sql = qq{select CUT_NAME from CUTS where CART_NUMBER='$cart';};
my $sth = $dbh->prepare($sql);
$sth->execute();
@@ -130,7 +132,7 @@ sub clear_carts
$sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish();
-
+
$cart++;
}
}
@@ -163,7 +165,11 @@ sub import_playlist
$cnt++;
}
- $progress_cb->($num_entries, $num_entries, "Import abgeschlossen!") if($progress_cb);
+ if($ret) {
+ $progress_cb->($num_entries, $num_entries, "Import abgeschlossen!") if($progress_cb);
+ } else {
+ $progress_cb->($cnt, $num_entries, "Import abgebrochen!") if($progress_cb);
+ }
return $ret;
}
@@ -174,7 +180,11 @@ sub import_single
print "Starting import from file $file to $dropbox\n";
$progress_cb->(0, 1, $file) if($progress_cb);
my $ret = import_file($file, $dropbox, $error_cb);
- $progress_cb->(1, 1, "Import abgeschlossen!") if($progress_cb);
+ if($ret) {
+ $progress_cb->(1, 1, "Import abgeschlossen!") if($progress_cb);
+ } else {
+ $progress_cb->(0, 1, "Import abgebrochen!") if($progress_cb);
+ }
return $ret;
}