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/rhrd-show | |
parent | 10e2d89361988bd25a7085a34a874c8bf8ce98b5 (diff) |
fix edit show (change title didn't work)
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-x | utils/rhrd-show | 40 |
1 files changed, 25 insertions, 15 deletions
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; |