diff options
Diffstat (limited to 'rhimport.pm')
-rw-r--r-- | rhimport.pm | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/rhimport.pm b/rhimport.pm index f96f7b4..c970bcf 100644 --- a/rhimport.pm +++ b/rhimport.pm @@ -102,7 +102,7 @@ sub get_used_carts sub clear_carts { - my ($dbh, $group, $to_cart, $error_cb) = @_; + my ($dbh, $group, $to_cart) = @_; my ($low_cart, $high_cart) = ($to_cart, $to_cart); if($to_cart == 0) { @@ -155,9 +155,7 @@ sub import_playlist my $cnt = 0; my $ret = 0; for my $entry ( @entries ) { - if($progress_cb) { - $progress_cb->($cnt, $num_entries, $entry); - } + $progress_cb->($cnt, $num_entries, $entry) if($progress_cb); $ret = import_file($entry, $dropbox, $error_cb); last if($ret == 0); @@ -165,9 +163,7 @@ sub import_playlist $cnt++; } - if($progress_cb) { - $progress_cb->($num_entries, $num_entries, "Import abgeschlossen!"); - } + $progress_cb->($num_entries, $num_entries, "Import abgeschlossen!") if($progress_cb); return $ret; } @@ -176,14 +172,9 @@ sub import_single { my ($file, $dropbox, $progress_cb, $error_cb) = @_; print "Starting import from file $file to $dropbox\n"; - if($progress_cb) { - $progress_cb->(0, 1, $file); - } + $progress_cb->(0, 1, $file) if($progress_cb); my $ret = import_file($file, $dropbox, $error_cb); - - if($progress_cb) { - $progress_cb->(1, 1, "Import abgeschlossen!"); - } + $progress_cb->(1, 1, "Import abgeschlossen!") if($progress_cb); return $ret; } @@ -214,6 +205,7 @@ sub ssh_exec_command { my $errstr = ""; if ( $? >> 8 ) { $errstr = join('', <$error>); + $errstr = "unkown error" if($errstr eq ""); } return ($out, $errstr); } |