diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-05-19 14:07:10 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-05-19 14:07:10 (GMT) |
commit | b4fe0e03eb1a712e379c2100ef92553afd4b26ed (patch) | |
tree | 3f858dd24a49059845328e8b0c4a9cad59297347 /utils | |
parent | 10e2d89361988bd25a7085a34a874c8bf8ce98b5 (diff) |
fix edit show (change title didn't work)
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-sanity-check | 18 | ||||
-rwxr-xr-x | utils/rhrd-show | 40 |
2 files changed, 34 insertions, 24 deletions
diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check index 74c1191..9507f6b 100755 --- a/utils/rhrd-sanity-check +++ b/utils/rhrd-sanity-check @@ -44,25 +44,25 @@ sub check_showids my $errors = 0, print "showids:\n"; - my @show_ids = RHRD::rddb::list_showids($ctx); - if(!defined $show_ids[0] && defined $show_ids[1]) { - print STDERR "$show_ids[1]: $show_ids[2]"; + my @showids = RHRD::rddb::list_showids($ctx); + if(!defined $showids[0] && defined $showids[1]) { + print STDERR "$showids[1]: $showids[2]"; return -1; } - for my $show_id (@show_ids) { - my @carts = RHRD::rddb::get_show_carts($ctx, $show_id); + for my $showid (@showids) { + my @carts = RHRD::rddb::get_show_carts($ctx, $showid); if(!defined $carts[0] && defined $carts[1]) { - print " showid '" . $show_id . "': $carts[2]\n"; + print " showid '" . $showid . "': $carts[2]\n"; $errors++; } if(scalar @carts == 0) { - print " showid '" . $show_id . "': log is empty\n"; + print " showid '" . $showid . "': log is empty\n"; $errors++; } - my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $show_id); + my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $showid); unless(defined($group)) { - print " showid '" . $show_id . "': has no dropbox assigned\n"; + print " showid '" . $showid . "': has no dropbox assigned\n"; $errors++; } else { } diff --git a/utils/rhrd-show b/utils/rhrd-show index 0c81c72..880ac5e 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -51,14 +51,14 @@ sub list sub show { - my ($ctx, $show_id) = @_; + my ($ctx, $showid) = @_; - my @carts = RHRD::rddb::get_show_carts($ctx, $show_id); + my @carts = RHRD::rddb::get_show_carts($ctx, $showid); if(!defined $carts[0] && defined $carts[1]) { print STDERR "$carts[1]: $carts[2]\n"; return 1; } - my ($show, $status, $errorstring) = RHRD::rddb::get_show_info($ctx, $show_id); + my ($show, $status, $errorstring) = RHRD::rddb::get_show_info($ctx, $showid); unless (defined $show) { print STDERR "$errorstring\n"; return 1; @@ -160,14 +160,14 @@ sub add } print " * created log with name: " . $name . "\n"; - (my $show_id, $status, $errorstring) = RHRD::rddb::create_show_macro_cart($ctx, $name, $title); + (my $showid, $status, $errorstring) = RHRD::rddb::create_show_macro_cart($ctx, $name, $title); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; } - print " * created macro cart -> new show-id = " . $show_id . "\n"; + print " * created macro cart -> new show-id = " . $showid . "\n"; - ($result, $status, $errorstring) = RHRD::rddb::create_show_dropbox($ctx, $groupname, $show_id, $rhythm, $dow, $starttime, $len); + ($result, $status, $errorstring) = RHRD::rddb::create_show_dropbox($ctx, $groupname, $showid, $rhythm, $dow, $starttime, $len); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; @@ -182,7 +182,7 @@ sub add sub edit__check_arguments { - my ($show_id, $title, $rhythm, $dow, $starttime, $len) = @_; + my ($showid, $title, $rhythm, $dow, $starttime, $len) = @_; my ($result, $err, $hint) = RHRD::utils::dropbox_param_rhythm_ok($rhythm); unless($result) { @@ -213,39 +213,49 @@ sub edit__check_arguments sub edit { - my ($ctx, $show_id, $title, $rhythm, $dow, $starttime, $len) = @_; + my ($ctx, $showid, $title, $rhythm, $dow, $starttime, $len) = @_; - my $ret = edit__check_arguments($show_id, $title, $rhythm, $dow, $starttime, $len); + my $ret = edit__check_arguments($showid, $title, $rhythm, $dow, $starttime, $len); if($ret) { return $ret; } ($dow, undef, undef) = RHRD::utils::cmdline_dow($dow); - my ($result, $status, $errorstring) = RHRD::rddb::update_show_dropbox($ctx, $show_id, $rhythm, $dow, $starttime, $len); + my ($result, $status, $errorstring) = RHRD::rddb::update_show_title($ctx, $showid, $title); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; } if ($result != 1) { - print "show '" . $show_id ."' does not exist.\n"; + print "show '" . $showid ."' does not exist.\n"; return 1; } - print "show '" . $show_id . "' successfully changed!\n"; + ($result, $status, $errorstring) = RHRD::rddb::update_show_dropbox($ctx, $showid, $rhythm, $dow, $starttime, $len); + unless(defined $result) { + print STDERR $status . ": " . $errorstring . "\n"; + return 1; + } + if ($result != 1) { + print "show '" . $showid ."' does not exist.\n"; + return 1; + } + + print "show '" . $showid . "' successfully changed!\n"; return 0; } sub remove { - my ($ctx, $show_id) = @_; + my ($ctx, $showid) = @_; - my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $show_id); + my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $showid); unless(defined $group) { print STDERR $status . ": " . $errorstring . "\n"; return 1; } - my @results = RHRD::rddb::remove_show($ctx, $show_id); + my @results = RHRD::rddb::remove_show($ctx, $showid); if(!defined $results[0] && defined $results[2]) { print STDERR $results[1] . ": " . $results[2] . "\n"; return 1; |