summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-31 16:05:45 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-31 16:05:45 (GMT)
commit131be9a185bd6d92cd0bafc9892a0a51189a3946 (patch)
treefe7ffc0d7a2158e60ff34143dcb8fe93701e3513 /utils
parentaf294a1f65fd66f0a0ecf59e199785703d1b947e (diff)
removing musicpool is now implemented
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rhrd-pool25
1 files changed, 21 insertions, 4 deletions
diff --git a/utils/rhrd-pool b/utils/rhrd-pool
index 93e943c..23b1cb2 100755
--- a/utils/rhrd-pool
+++ b/utils/rhrd-pool
@@ -29,7 +29,8 @@ use Date::Calc;
sub print_usage
{
print STDERR "Usage: rhrd-pool list\n" .
- " rhrd-pool (show|remove) <short-name>\n" .
+ " rhrd-pool show <short-name>\n" .
+ " rhrd-pool remove <short-name> [--force]\n" .
" rhrd-pool add <groupname> <title>\n" .
" rhrd-pool edit <short-name> <title>\n";
}
@@ -179,7 +180,23 @@ sub edit
sub remove
{
- my ($ctx, $shortname) = @_;
+ my ($ctx, $shortname, $force) = @_;
+
+ if(defined($force) && $force ne "--force") {
+ print_usage();
+ return 1;
+ }
+
+ my @slots = RHRD::rddb::get_musicpool_clock_usage($ctx, $shortname);
+ if(!defined $slots[0] && defined $slots[1]) {
+ print STDERR "$slots[1]: $slots[2]";
+ return 1;
+ }
+ if(scalar(@slots) > 0) {
+ print STDERR "musicpool is still in use (" . scalar(@slots) . " grid entries)\n";
+ return 1 unless(defined($force));
+ print STDERR " *** forced removal ***\n"
+ }
my @results = RHRD::rddb::remove_musicpool($ctx, $shortname);
if(!defined $results[0] && defined $results[2]) {
@@ -220,11 +237,11 @@ if(defined $ctx) {
}
}
elsif($cmd eq "remove") {
- if($num_args != 2) {
+ if($num_args < 2 || $num_args > 3) {
print_usage();
$ret = 1;
} else {
- $ret = remove($ctx, $ARGV[1]);
+ $ret = remove($ctx, $ARGV[1], $ARGV[2]);
}
}
elsif($cmd eq "add") {