summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/RHRD/rddb.pm30
-rwxr-xr-xutils/rhrd-show35
2 files changed, 64 insertions, 1 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index da3a1e5..4f8f469 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -2064,6 +2064,36 @@ sub create_multi_show
return ($number, 'OK', 'success');
}
+sub get_multi_show_info
+{
+ my ($ctx, $showid) = @_;
+
+ my $sql = qq{select TITLE,USER_DEFINED from CART where NUMBER = ?};
+
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($showid)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my ($title, $shows) = $sth->fetchrow_array();
+ $sth->finish();
+
+ my $entry = {};
+ $entry->{'ID'} = $showid;
+ $entry->{'TITLE'} = $title;
+ $entry->{'SHOWS'} = {};
+
+ my @showlist = split(';', $shows);
+ foreach my $show (@showlist) {
+ my ($week, $showid) = split(':', $show, 2);
+ next unless(defined($week) && defined($showid));
+ $entry->{'SHOWS'}{int($week)} = int($showid);
+ }
+
+ return ($entry, 'OK', 'success');
+}
+
sub remove_multi_show
{
my ($ctx, $showid) = @_;
diff --git a/utils/rhrd-show b/utils/rhrd-show
index ef8cb7a..534f467 100755
--- a/utils/rhrd-show
+++ b/utils/rhrd-show
@@ -327,7 +327,7 @@ sub multi_list
for my $href (@sorted) {
my %showids = %{$href->{'SHOWS'}};
my $showstr = join(", ", map { "W$_: $showids{$_}" } sort keys %showids);
- print $href->{'ID'} . ": " . $href->{'TITLE'} . ": (" . $showstr . ")\n";
+ print $href->{'ID'} . ": " . $href->{'TITLE'} . " (" . $showstr . ")\n";
}
return 0;
}
@@ -411,6 +411,31 @@ sub multi_add
return 0;
}
+sub multi_show
+{
+ my ($ctx, $showid) = @_;
+
+ my ($show, $status, $errorstring) = RHRD::rddb::get_multi_show_info($ctx, $showid);
+ unless (defined $show) {
+ print STDERR "$errorstring\n";
+ return 1;
+ }
+ print $show->{'TITLE'} . ":\n";
+
+ my %showids = %{$show->{'SHOWS'}};
+ foreach my $week (sort keys %showids) {
+ if($showids{$week} > 0) {
+ (my $title, undef, $status, $errorstring) = RHRD::rddb::get_show_title_and_log($ctx, $showids{$week});
+ unless(defined $title) {
+ print STDERR $status . ": " . $errorstring . "\n";
+ return 1;
+ }
+ print " - W" . $week . ": (" . $showids{$week} . ") " . $title . "\n";
+ }
+ }
+ return 0;
+}
+
sub multi_remove
{
my ($ctx, $showid) = @_;
@@ -512,6 +537,14 @@ if(defined $ctx) {
$ret = multi_add($ctx, $title, @ARGV)
}
}
+ elsif($cmd eq "multi-show") {
+ if($num_args != 2) {
+ print_usage();
+ $ret = 1;
+ } else {
+ $ret = multi_show($ctx, $ARGV[1]);
+ }
+ }
elsif($cmd eq "multi-remove") {
if($num_args != 2) {
print_usage();