summaryrefslogtreecommitdiff
path: root/rh-bin
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-23 18:55:44 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-23 18:55:44 (GMT)
commitcc7d0e4ae43b6ec892a51bf6b58f33209ca7805e (patch)
treeff0f3336cb223c2892a0f6a4af4403493743acad /rh-bin
parent887f5d6049189554449249f85338d45322baef06 (diff)
implemented show listing
Diffstat (limited to 'rh-bin')
-rwxr-xr-xrh-bin/showlist.json21
1 files changed, 18 insertions, 3 deletions
diff --git a/rh-bin/showlist.json b/rh-bin/showlist.json
index ce59748..185a0a5 100755
--- a/rh-bin/showlist.json
+++ b/rh-bin/showlist.json
@@ -27,19 +27,34 @@ use JSON;
my $status = 'ERROR';
my $errorstring = 'unknown';
my $responsecode = 500;
+my @showlist;
(my $ctx, $status, $errorstring) = RHRD::rddb::init();
if(defined $ctx) {
- $status = 'ERROR';
- $errorstring = 'not yet implemented';
- $responsecode = 501;
+ my @shows = RHRD::rddb::list_shows($ctx);
+ if(!defined $shows[0] && defined $shows[1]) {
+ $responsecode = 500;
+ $status = $shows[1];
+ $errorstring = $shows[2];
+ } else {
+ for my $href (@shows) {
+ my %show;
+ $show{'id'} = $href->{'ID'};
+ $show{'title'} = $href->{'ID'} . " | " . $href->{'TITLE'};
+ push @showlist, %show;
+ }
+ $responsecode = 200;
+ $status = "OK";
+ $errorstring = "success";
+ }
RHRD::rddb::destroy($ctx);
}
my %answer;
$answer{'status'} = $status;
$answer{'errorstring'} = $errorstring;
+$answer{'shows'} = \@showlist;
print "Content-type: application/json; charset=UTF-8\n";
print "Status: $responsecode\n\n";