diff options
author | Christian Pointner <equinox@helsinki.at> | 2010-03-24 13:07:46 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2010-03-24 13:07:46 (GMT) |
commit | 5b52de65b47f868e0b3224e06e766116afc81b39 (patch) | |
tree | 9cd4b714404c8aa06ed964bc936c932ee01f1ac5 /rhimport | |
parent | c9d2691935e2a87cb74b6f04ad6b4f561728e0c6 (diff) |
fixed clear vs keep carts
cleanups
Diffstat (limited to 'rhimport')
-rwxr-xr-x | rhimport | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -38,26 +38,26 @@ my $DB = "rivendell"; my $HELP = 0; my $FILE = ""; my $POOL = 0; -my $EMPTYCARTS = 0; +my $KEEPCARTS = 0; my $DROPBOX = ""; my $LISTALLOWED = 0; GetOptions ("help!" => \$HELP, "file=s" => \$FILE, "pool!" => \$POOL, - "empty-carts!" => \$EMPTYCARTS, + "keep-carts!" => \$KEEPCARTS, "dropbox=s" => \$DROPBOX, "list-allowed!" => \$LISTALLOWED, ); if($HELP) { print << "EOF"; -usage: $0 --file <audio or playlist file> --pool --empty-carts --dropbox <path to dropbox> --list-allowed +usage: $0 --file <audio or playlist file> --pool --keep-carts --dropbox <path to dropbox> --list-allowed options: --file the media file or playlist to import --pool pool mode, import media files referneced by playlist - --empty-carts emtpy out pool of carts before import + --keep-carts in pool mode keep existing carts instead of clearing them before import --dropbox the path to the dropbox to use --list-allowed list allowed dropboxes and exit @@ -73,7 +73,7 @@ my @allowed_dbs = rhimport::get_dropboxes($dbh, $user); if($LISTALLOWED) { for my $href ( @allowed_dbs ) { - print "$href->{'PATH'}\n"; + print "$href->{'NAME'} \t-> $href->{'PATH'}\n"; } $dbh->disconnect(); exit 0; @@ -164,11 +164,11 @@ sub start_import_gui() if($POOL) { my $cb_clear_carts = $guixml->get_widget('cb_clear_carts'); if($cb_clear_carts->get_active) { - rhimport::empty_carts($dbh, $group); + rhimport::clear_carts($dbh, $group); } $ret = rhimport::import_playlist($file, $dropbox); } else { - $ret = rhimport::import_file($file, $dropbox); + $ret = rhimport::import_single($file, $dropbox); } return $ret; @@ -187,8 +187,11 @@ sub show_used_carts_gui() my $l_status = $guixml->get_widget('l_status'); my ($low_cart, $high_cart) = rhimport::get_cart_range($dbh, $group); - $l_status->set_label("Carts: $low_cart - $high_cart"); - + if($low_cart eq $high_cart) { + $l_status->set_label("Cart: $low_cart"); + } else { + $l_status->set_label("Carts: $low_cart - $high_cart"); + } # my $usedcartswin = $guixml->get_widget('usedcartswin'); # $usedcartswin or die "can't find Widget"; @@ -216,10 +219,10 @@ if(!$FILE || !$DROPBOX) { $co_dropbox->set_active(0); my $cb_clear_carts = $guixml->get_widget('cb_clear_carts'); - if($EMPTYCARTS) { - $cb_clear_carts->set_active(1); - } else { + if($KEEPCARTS) { $cb_clear_carts->set_active(0); + } else { + $cb_clear_carts->set_active(1); } if($POOL) { @@ -262,13 +265,13 @@ if($group eq '') { my $ret; if($POOL) { - if($EMPTYCARTS) { - rhimport::empty_carts($dbh, $group); + if(!$KEEPCARTS) { + rhimport::clear_carts($dbh, $group); } $ret = rhimport::import_playlist($FILE, $DROPBOX); } else { - $ret = rhimport::import_file($FILE, $DROPBOX); + $ret = rhimport::import_single($FILE, $DROPBOX); } $dbh->disconnect(); |