diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-11-25 23:10:47 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-11-25 23:10:47 (GMT) |
commit | 1c231c329cccf70fa809f57e75378f0963742388 (patch) | |
tree | 8d3ce21dc82c8137638d04f224e25c104f99ab6a /utils/rhrd-show | |
parent | 2309e83af61203a814ade7a5df89cd68f73d41ef (diff) |
also add show types to multi-shows
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-x | utils/rhrd-show | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show index 8bdc4cf..a9e0abc 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -37,8 +37,8 @@ sub print_usage " multi show handling:\n" . " rhrd-show multi-list\n" . " rhrd-show (multi-show|multi-remove) <multi-show-id>\n" . - " rhrd-show multi-add <title> <week>=<show-id> [ <week>=<show-id> [ .. ] ]\n" . - " rhrd-show multi-edit <multi-show-id> <title> <week>=<show-id> [ <week>=<show-id> [ .. ] ]\n"; + " rhrd-show multi-add <title> <type> <week>=<show-id> [ <week>=<show-id> [ .. ] ]\n" . + " rhrd-show multi-edit <multi-show-id> <title> <type> <week>=<show-id> [ <week>=<show-id> [ .. ] ]\n"; } sub list @@ -340,8 +340,9 @@ sub multi_list my @sorted = sort { lc($a->{'TITLE'}) cmp lc($b->{'TITLE'}) } @mshows; for my $href (@sorted) { my %showids = %{$href->{'SHOWS'}}; + my $showtype = RHRD::utils::dropbox_param_showtype_to_string($href->{'TYPE'}); my $showstr = join(", ", map { "W$_: $showids{$_}" } sort keys %showids); - print $href->{'ID'} . ": " . $href->{'TITLE'} . " (" . $showstr . ")\n"; + print $href->{'ID'} . ": " . $href->{'TITLE'} . ", " . $showtype. ", (" . $showstr . ")\n"; } return 0; } @@ -406,6 +407,13 @@ sub multi_add { my $ctx = shift; my $title = shift; + my $type = shift; + + my ($result, $err, $hint) = RHRD::utils::dropbox_param_showtype_ok($type); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } print " * creating multi-show: " . $title . "\n"; @@ -415,7 +423,7 @@ sub multi_add } my %shows = %{$showref}; - my ($result, $status, $errorstring) = RHRD::rddb::create_multi_show($ctx, $title, \%shows); + ($result, my $status, my $errorstring) = RHRD::rddb::create_multi_show($ctx, $title, $type, \%shows); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; @@ -431,6 +439,13 @@ sub multi_edit my $ctx = shift; my $showid = shift; my $title = shift; + my $type = shift; + + my ($result, $err, $hint) = RHRD::utils::dropbox_param_showtype_ok($type); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; + return 1; + } print " * updating multi-show: " . $showid . "\n"; @@ -440,7 +455,7 @@ sub multi_edit } my %shows = %{$showref}; - my ($result, $status, $errorstring) = RHRD::rddb::update_multi_show($ctx, $showid, $title, \%shows); + ($result, my $status, my $errorstring) = RHRD::rddb::update_multi_show($ctx, $showid, $title, $type, \%shows); unless(defined $result) { print STDERR $status . ": " . $errorstring . "\n"; return 1; @@ -459,7 +474,8 @@ sub multi_show print STDERR "$errorstring\n"; return 1; } - print $show->{'TITLE'} . ":\n"; + my $showtype = RHRD::utils::dropbox_param_showtype_to_string($show->{'TYPE'}); + print $show->{'TITLE'} . ": " . $showtype . "\n"; my %showids = %{$show->{'SHOWS'}}; foreach my $week (sort keys %showids) { @@ -578,13 +594,14 @@ if(defined $ctx) { } } elsif($cmd eq "multi-add") { - if($num_args < 3) { + if($num_args < 4) { print_usage(); $ret = 1; } else { shift @ARGV; my $title = shift @ARGV; - $ret = multi_add($ctx, $title, @ARGV) + my $type = shift @ARGV; + $ret = multi_add($ctx, $type, @ARGV) } } elsif($cmd eq "multi-show") { @@ -604,14 +621,15 @@ if(defined $ctx) { } } elsif($cmd eq "multi-edit") { - if($num_args < 4) { + if($num_args < 5) { print_usage(); $ret = 1; } else { shift @ARGV; my $showid = shift @ARGV; my $title = shift @ARGV; - $ret = multi_edit($ctx, $showid, $title, @ARGV) + my $type = shift @ARGV; + $ret = multi_edit($ctx, $showid, $title, $type, @ARGV) } } else { |