From 8906b9a5e8f87af82b67e6b98f60503d4b3f484c Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 29 Mar 2010 07:37:15 +0000 Subject: sanity check for clear carts when in pool mode for single cart show git-svn-id: https://svn.helsinki.at/rhimport/trunk@30 7c65635b-ec39-4f67-a626-873dbafdd612 diff --git a/rhimport b/rhimport index 0b69652..49d981d 100755 --- a/rhimport +++ b/rhimport @@ -216,6 +216,7 @@ sub start_import_gui() my $co_dropbox = $guixml->get_widget('co_dropbox'); my $dropbox = $allowed_dbs[$co_dropbox->get_active]->{'PATH'}; my $group = $allowed_dbs[$co_dropbox->get_active]->{'GROUP'}; + my $to_cart = $allowed_dbs[$co_dropbox->get_active]->{'TO_CART'}; $l_status->set_label("importiere von $file"); @@ -223,7 +224,7 @@ sub start_import_gui() if($POOL) { my $cb_clear_carts = $guixml->get_widget('cb_clear_carts'); if($cb_clear_carts->get_active) { - rhimport::clear_carts($dbh, $group); + rhimport::clear_carts($dbh, $group, $to_cart); } $ret = rhimport::import_playlist($file, $dropbox, $gui_progress_cb); } else { @@ -344,9 +345,12 @@ if($POOL) { } my $group = ''; +my $to_cart = 0; for my $href (@allowed_dbs) { if($href->{'PATH'} eq $DROPBOX) { $group = $href->{'GROUP'}; + $to_cart = $href->{'TO_CART'}; + last; } } @@ -358,7 +362,7 @@ if($group eq '') { my $ret; if($POOL) { if(!$KEEPCARTS) { - rhimport::clear_carts($dbh, $group); + rhimport::clear_carts($dbh, $group, $to_cart); } $ret = rhimport::import_playlist($FILE, $DROPBOX); diff --git a/rhimport.pm b/rhimport.pm index 4729969..333e61c 100644 --- a/rhimport.pm +++ b/rhimport.pm @@ -97,7 +97,12 @@ sub clear_carts { my $dbh = shift; my $group = shift; - my ($low_cart, $high_cart) = get_cart_range($dbh, $group); + my $to_cart = shift; + + my ($low_cart, $high_cart) = ($to_cart, $to_cart); + if($to_cart == 0) { + ($low_cart, $high_cart) = get_cart_range($dbh, $group); + } print "clearing Carts $low_cart - $high_cart\n"; my $cart = $low_cart; -- cgit v0.10.2