diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-10-07 01:56:44 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-10-07 01:56:44 (GMT) |
commit | a67de4921bd05a567e5957729f1e2d06358d1218 (patch) | |
tree | f75ae3465dc318059614a75e1b1b95b55247639d /utils | |
parent | fdb8d0f78ad94dbaa352c6bb096cbf63863dfe7d (diff) |
moved some parts of add show command to rddb
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-show | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show index 276eaef..6f3bc7d 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -127,7 +127,7 @@ sub add__get_show_carts my $low_cart = 0; if($result) { print " > using existing group '" . $groupname . "'\n"; - $low_cart = add__get_free_group_carts($ctx, $groupname, $num_carts); + ($low_cart, $status, $errorstring) = RHRD::rddb::get_next_free_show_group_carts($ctx, $groupname, $num_carts); } else { print " > '" . $groupname . "' does not exist - creating it .. "; $low_cart = add__create_group($ctx, $groupname); @@ -172,48 +172,6 @@ sub add__create_group return $low_cart; } -sub add__get_free_group_carts -{ - my ($ctx, $groupname, $num_carts) = @_; - - my ($low_cart, $high_cart, $type, undef) = RHRD::rddb::get_group_cart_range($ctx, $groupname); - unless(defined $low_cart) { - print STDERR $high_cart . ": " . $type . "\n"; - return undef; - } - - my @dropboxes = RHRD::rddb::get_dropboxes($ctx, $ctx->{'config'}{'shows'}{'defaultuser'}, $groupname, 'S'); - if(!defined $dropboxes[0]) { - if(defined $dropboxes[1]) { - print STDERR "$dropboxes[1]: $dropboxes[2]"; - return undef; - } - return $low_cart; - } - - my @carts = (); - for my $db (@dropboxes) { - my @show_carts = RHRD::rddb::get_show_carts($ctx, $db->{'SHOWID'}); - if(!defined $show_carts[0] && defined $show_carts[1]) { - print STDERR "$show_carts[1]: $show_carts[2]\n"; - return undef; - } - @carts = (@carts, @show_carts) if defined($show_carts[0]) - } - - @carts = sort(@carts); - for my $cart (@carts) { - last if(($low_cart + $num_carts - 1) < $cart); - $low_cart += 1; - } - if(($low_cart + $num_carts -1) > $high_cart) { - print STDERR "there are not enough free carts\n"; - return undef; - } - - return $low_cart; -} - sub add { my ($ctx, $groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len) = @_; |