From 043bcc2f9a395458c18f369f06ac876d26a9b814 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 14 Sep 2016 18:43:37 +0200 Subject: multi shows listing works now diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 38abb1d..d4ff7a5 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -1985,12 +1985,18 @@ sub list_multi_shows my @mshows; while(my ($id, $title, $shows) = $sth->fetchrow_array()) { - my @showlist = split(';', $shows); # TODO split this further... my $entry = {}; $entry->{'ID'} = $id; $entry->{'TITLE'} = $title; - $entry->{'SHOWS'} = \@showlist; + $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); + } push @mshows, $entry; } diff --git a/utils/rhrd-show b/utils/rhrd-show index 950e898..dad0800 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -325,8 +325,9 @@ sub multi_list } my @sorted = sort { lc($a->{'TITLE'}) cmp lc($b->{'TITLE'}) } @mshows; for my $href (@sorted) { - print $href->{'ID'} . ": " . Dumper($href) . "\n"; -# print $href->{'ID'} . ": " . $href->{'TITLE'} . ": (" . join(@$href->{'SHOWS'}, ", ") . ")\n"; + my %showids = %{$href->{'SHOWS'}}; + my $showstr = join(", ", map { "W$_: $showids{$_}" } sort keys %showids); + print $href->{'ID'} . ": " . $href->{'TITLE'} . ": (" . $showstr . ")\n"; } return 0; } -- cgit v0.10.2