diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-sanity-check | 1 | ||||
-rwxr-xr-x | utils/rhrd-show | 34 |
2 files changed, 31 insertions, 4 deletions
diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check index 20179d1..cdfa0b4 100755 --- a/utils/rhrd-sanity-check +++ b/utils/rhrd-sanity-check @@ -271,6 +271,7 @@ sub check_groups for my $group (@groups) { next if($group eq $ctx->{'config'}{'specialgroups'}{'system'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'shows'}); + next if($group eq $ctx->{'config'}{'specialgroups'}{'multishows'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'allshows'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'allpools'}); next if($group eq $ctx->{'config'}{'specialgroups'}{'alljingles'}); diff --git a/utils/rhrd-show b/utils/rhrd-show index 5ed0f4b..0d4ad58 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -163,6 +163,30 @@ sub add__check_arguments return 0; } +sub add__check_showgroup +{ + my ($ctx, $groupname) = @_; + + my ($low_cart, $high_cart, $errorstring) = RHRD::rddb::get_group_cart_range($ctx, $groupname); + unless(defined $low_cart) { + print STDERR "$errorstring\n"; + return 1; + } + + (my $shows_low_cart, my $shows_high_cart, $errorstring) = RHRD::rddb::get_shows_cart_range($ctx); + unless(defined $shows_low_cart) { + print STDERR "$errorstring\n"; + return 1; + } + + if($shows_low_cart > $low_cart || $shows_high_cart < $high_cart) { + print STDERR "group '" . $groupname . "' already exists but is not a show group\n"; + return 1; + } + + return 0; +} + sub add { my ($ctx, $groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len, $type) = @_; @@ -173,8 +197,6 @@ sub add } ($dow, undef, undef) = RHRD::utils::cmdline_dow($dow); - print " * creating show: " . $title . " (" . $name . ") for group '" . $groupname . "'\n"; - my ($result, $status, $errorstring) = RHRD::rddb::check_group($ctx, $groupname); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; @@ -183,10 +205,14 @@ sub add my $low_cart = 0; if($result) { - print " * using existing group '" . $groupname . "'\n"; + my $ret = add__check_showgroup($ctx, $groupname); + if($ret) { + return $ret; + } + print " * creating show: " . $title . " (" . $name . ") using existing group '" . $groupname . "'\n"; ($low_cart, $status, $errorstring) = RHRD::rddb::get_next_free_show_group_carts($ctx, $groupname, $num_carts); } else { - print " * '" . $groupname . "' does not exist - creating it\n"; + print " * creating show: " . $title . " (" . $name . ") using new group '" . $groupname . "'\n"; ($low_cart, $status, $errorstring) = RHRD::rddb::create_show_group($ctx, $groupname); } unless(defined $low_cart) { |