summaryrefslogtreecommitdiff
path: root/utils/rhrd-show
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-14 20:49:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-14 21:04:40 (GMT)
commitdf8affb33e4230860545b4a3e36eb791363a341f (patch)
tree499fa8229352219fea32db8e773891c87bbd7d6e /utils/rhrd-show
parent444c7d9f9da66309ed0e4e2d6d7050ecc436b0fc (diff)
implemented multi-edit
Diffstat (limited to 'utils/rhrd-show')
-rwxr-xr-xutils/rhrd-show47
1 files changed, 42 insertions, 5 deletions
diff --git a/utils/rhrd-show b/utils/rhrd-show
index 534f467..af5079c 100755
--- a/utils/rhrd-show
+++ b/utils/rhrd-show
@@ -38,8 +38,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-add-id|multi-remove-id) <multi-show-id> <show-id> [ <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";
}
sub list
@@ -314,6 +314,7 @@ sub remove
return 0;
}
+
sub multi_list
{
my ($ctx) = @_;
@@ -333,7 +334,7 @@ sub multi_list
}
-sub multi_add__parse_shows
+sub multi__parse_shows
{
my $ctx = shift;
@@ -395,10 +396,11 @@ sub multi_add
print " * creating multi-show: " . $title . "\n";
- my %shows = %{multi_add__parse_shows($ctx, @_)};
- unless(%shows) {
+ my $showref = multi__parse_shows($ctx, @_);
+ unless(defined($showref)) {
return 1;
}
+ my %shows = %{$showref};
my ($result, $status, $errorstring) = RHRD::rddb::create_multi_show($ctx, $title, \%shows);
unless(defined $result) {
@@ -411,6 +413,30 @@ sub multi_add
return 0;
}
+sub multi_edit
+{
+ my $ctx = shift;
+ my $showid = shift;
+ my $title = shift;
+
+ print " * updating multi-show: " . $showid . "\n";
+
+ my $showref = multi__parse_shows($ctx, @_);
+ unless(defined($showref)) {
+ return 1;
+ }
+ my %shows = %{$showref};
+
+ my ($result, $status, $errorstring) = RHRD::rddb::update_multi_show($ctx, $showid, $title, \%shows);
+ unless(defined $result) {
+ print STDERR $status . ": " . $errorstring . "\n";
+ return 1;
+ }
+
+ print " * mulit-show '" . $showid . "' successfully changed!\n";
+ return 0;
+}
+
sub multi_show
{
my ($ctx, $showid) = @_;
@@ -553,6 +579,17 @@ if(defined $ctx) {
$ret = multi_remove($ctx, $ARGV[1]);
}
}
+ elsif($cmd eq "multi-edit") {
+ if($num_args < 4) {
+ print_usage();
+ $ret = 1;
+ } else {
+ shift @ARGV;
+ my $showid = shift @ARGV;
+ my $title = shift @ARGV;
+ $ret = multi_edit($ctx, $showid, $title, @ARGV)
+ }
+ }
else {
print_usage();
$ret = 1;