diff options
author | Christian Pointner <equinox@spreadspace.org> | 2016-05-18 13:41:44 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2016-05-18 13:41:44 (GMT) |
commit | 635dfff6d078e40afef725be9041a52a8a9d0189 (patch) | |
tree | d18e31f7fe00263f9e6c48b9d228cd2646b87db9 /utils | |
parent | ef2a72d539de74f4d3fef4ad06c144825a513a83 (diff) |
added scaffold for edit function to rhrd-show
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-show | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show index 3cac649..cab6ead 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -21,6 +21,7 @@ # use strict; +use lib "../lib/"; use RHRD::rddb; use RHRD::utils; use Date::Calc; @@ -29,7 +30,8 @@ sub print_usage { print STDERR "Usage: rhrd-show list [ <group> ]\n" . " rhrd-show (show|remove) <show-id>\n" . - " rhrd-show add <groupname> <name> <title> <num-carts> <rhythm> <dow> <starttime> <len>\n"; + " rhrd-show add <groupname> <name> <title> <num-carts> <rhythm> <dow> <starttime> <len>\n" . + " rhrd-show edit <show-id> <title> <rhythm> <dow> <starttime> <len>\n"; } sub list @@ -41,7 +43,8 @@ sub list print STDERR "$shows[1]: $shows[2]"; return 1; } - for my $href (@shows) { + my @sorted = sort { lc($a->{'TITLE'}) cmp lc($b->{'TITLE'}) } @shows; + for my $href (@sorted) { print $href->{'ID'} . ": " . $href->{'TITLE'} . "\n"; } return 0; @@ -177,6 +180,51 @@ sub add return 0; } +sub edit__check_arguments +{ + my ($showid, $title, $rhythm, $dow, $starttime, $len) = @_; + + my ($result, $err, $hint) = RHRD::utils::dropbox_param_rhythm_ok($rhythm); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + + ($result, $err, $hint) = RHRD::utils::cmdline_dow($dow); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + + ($result, $err, $hint) = RHRD::utils::dropbox_param_starttime_ok($starttime); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + + ($result, $err, $hint) = RHRD::utils::dropbox_param_len_ok($len); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + + return 0; +} + +sub edit +{ + my ($ctx, $showid, $title, $rhythm, $dow, $starttime, $len) = @_; + + my $ret = edit__check_arguments($showid, $title, $rhythm, $dow, $starttime, $len); + if($ret) { + return $ret; + } + + print " not yet implemented!!\n"; + + return 1; +} + sub remove { my ($ctx, $show_id) = @_; @@ -250,6 +298,14 @@ if(defined $ctx) { $ret = add($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7], $ARGV[8]); } } + elsif($cmd eq "edit") { + if($num_args != 7) { + print_usage(); + $ret = 1; + } else { + $ret = edit($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6]); + } + } else { print_usage(); $ret = 1; |