diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-11-25 21:52:08 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-11-25 21:52:08 (GMT) |
commit | b40c235c699e737431ded7c4ccdc57c5c80be770 (patch) | |
tree | d697a81e8bc73c493f5132b6af74eff6cb85c14a /utils/rhrd-show | |
parent | 1eab56a6601fc41643cdc3d9372462edf3f5000d (diff) |
implemented show types
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-x | utils/rhrd-show | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show index 97d74d3..8bdc4cf 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -31,8 +31,8 @@ sub print_usage print STDERR "Usage: rhrd-show list [ <group> ]\n" . " rhrd-show search <expression>\n" . " rhrd-show (show|remove) <show-id>\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" . + " rhrd-show add <groupname> <name> <title> <num-carts> <rhythm> <dow> <starttime> <len> <type>\n" . + " rhrd-show edit <show-id> <title> <rhythm> <dow> <starttime> <len> <type>\n" . "\n" . " multi show handling:\n" . " rhrd-show multi-list\n" . @@ -71,8 +71,9 @@ sub search next unless $show->{'TITLE'} =~ /$searchexp/i; $show->{'DOW'} = 7 if $show->{'DOW'} == 0; + my $showtype = RHRD::utils::dropbox_param_showtype_to_string($show->{'TYPE'}); print $show->{'ID'} . ": " . $show->{'TITLE'} . ", "; - print join(", ", $show->{'RHYTHM'}, Date::Calc::Day_of_Week_to_Text($show->{'DOW'}), $show->{'STARTTIME'}, ($show->{'LEN'} . " min")); + print join(", ", $show->{'RHYTHM'}, Date::Calc::Day_of_Week_to_Text($show->{'DOW'}), $show->{'STARTTIME'}, ($show->{'LEN'} . " min"), $showtype); print ", group: " . $show->{'GROUP'} . "\n"; } return 0; @@ -93,15 +94,16 @@ sub show return 1; } $show->{'DOW'} = 7 if $show->{'DOW'} == 0; - print $show->{'TITLE'} . ": " . join(", ", $show->{'RHYTHM'}, Date::Calc::Day_of_Week_to_Text($show->{'DOW'}), $show->{'STARTTIME'}, ($show->{'LEN'} . " min")) . "\n"; - print " group: " . $show->{'GROUP'} . ", carts(" . scalar(@carts) . "): " . join(", ", @carts) . " \n"; + my $showtype = RHRD::utils::dropbox_param_showtype_to_string($show->{'TYPE'}); + print $show->{'TITLE'} . ": " . join(", ", $show->{'RHYTHM'}, Date::Calc::Day_of_Week_to_Text($show->{'DOW'}), $show->{'STARTTIME'}, ($show->{'LEN'} . " min"), $showtype) . "\n"; + print " group: " . $show->{'GROUP'} . ", carts(" . scalar(@carts) . "): " . join(", ", @carts) . "\n"; return 0; } sub add__check_arguments { - my ($groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len) = @_; + my ($groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len, $type) = @_; if($groupname !~ m/^[-a-zA-Z0-9_]{1,10}$/) { print STDERR "name '" . $groupname . "' contains illegal characters or is too long/short\n"; @@ -144,14 +146,20 @@ sub add__check_arguments return 1; } + ($result, $err, $hint) = RHRD::utils::dropbox_param_showtype_ok($type); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + return 0; } sub add { - my ($ctx, $groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len) = @_; + my ($ctx, $groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len, $type) = @_; - my $ret = add__check_arguments($groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len); + my $ret = add__check_arguments($groupname, $name, $title, $num_carts, $rhythm, $dow, $starttime, $len, $type); if($ret) { return $ret; } @@ -195,7 +203,7 @@ sub add } print " * created macro cart -> new show-id = " . $showid . "\n"; - ($result, $status, $errorstring) = RHRD::rddb::create_show_dropbox($ctx, $groupname, $showid, $rhythm, $dow, $starttime, $len); + ($result, $status, $errorstring) = RHRD::rddb::create_show_dropbox($ctx, $groupname, $showid, $rhythm, $dow, $starttime, $len, $type); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; @@ -210,7 +218,7 @@ sub add sub edit__check_arguments { - my ($showid, $title, $rhythm, $dow, $starttime, $len) = @_; + my ($showid, $title, $rhythm, $dow, $starttime, $len, $type) = @_; my ($result, $err, $hint) = RHRD::utils::dropbox_param_rhythm_ok($rhythm); unless($result) { @@ -236,14 +244,20 @@ sub edit__check_arguments return 1; } + ($result, $err, $hint) = RHRD::utils::dropbox_param_showtype_ok($type); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } + return 0; } sub edit { - my ($ctx, $showid, $title, $rhythm, $dow, $starttime, $len) = @_; + my ($ctx, $showid, $title, $rhythm, $dow, $starttime, $len, $type) = @_; - my $ret = edit__check_arguments($showid, $title, $rhythm, $dow, $starttime, $len); + my $ret = edit__check_arguments($showid, $title, $rhythm, $dow, $starttime, $len, $type); if($ret) { return $ret; } @@ -259,7 +273,7 @@ sub edit return 1; } - ($result, $status, $errorstring) = RHRD::rddb::update_show_dropbox($ctx, $showid, $rhythm, $dow, $starttime, $len); + ($result, $status, $errorstring) = RHRD::rddb::update_show_dropbox($ctx, $showid, $rhythm, $dow, $starttime, $len, $type); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; @@ -540,19 +554,19 @@ if(defined $ctx) { } } elsif($cmd eq "add") { - if($num_args != 9) { + if($num_args != 10) { print_usage(); $ret = 1; } else { - $ret = add($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7], $ARGV[8]); + $ret = add($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7], $ARGV[8], $ARGV[9]); } } elsif($cmd eq "edit") { - if($num_args != 7) { + if($num_args != 8) { print_usage(); $ret = 1; } else { - $ret = edit($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6]); + $ret = edit($ctx, $ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], $ARGV[5], $ARGV[6], $ARGV[7]); } } elsif($cmd eq "multi-list") { |