diff options
author | Christian Pointner <equinox@helsinki.at> | 2014-09-19 23:45:16 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2014-09-19 23:45:16 (GMT) |
commit | be89d5f1957d159df4289494c7cab9722e8dc9a5 (patch) | |
tree | 05891bad7bbe320090d01e0715a1e3cd4bb774de /listshows.cgi | |
parent | 59984c7553efdd0bb27eb932cecc07609c112245 (diff) |
renamed listdropboxes to listshows
loading show list
Diffstat (limited to 'listshows.cgi')
-rwxr-xr-x | listshows.cgi | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/listshows.cgi b/listshows.cgi new file mode 100755 index 0000000..7ef0bcf --- /dev/null +++ b/listshows.cgi @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +use strict; +use CGI; +use File::Basename; +use lib dirname( __FILE__ ) . '/lib'; +use rddb; + +binmode(STDIN, ":utf8"); +binmode(STDOUT, ":utf8"); +binmode(STDERR, ":utf8"); + +my $status = 'ERROR'; +my $errorstring = 'unknown'; +my $responsecode = 500; +my @dropboxes = (); + +my $q = CGI->new; +my $username = $q->param('LOGIN_NAME'); +my $token = $q->param('PASSWORD'); + +my $dbh; +($dbh, $status, $errorstring) = rddb::opendb(); +if(defined $dbh) { + my $result; + ($result, $status, $errorstring) = rddb::check_token($dbh, $username, $token); + if($result == 1) { + $responsecode = 200; + @dropboxes = rddb::get_dropboxes($dbh, $username); + } elsif($result == 0) { + $responsecode = 403; + } else { + $responsecode = 500; + } + rddb::closedb($dbh); +} + +print "Content-type: application/xml; charset=UTF-8\n\n"; + +if($responsecode != 200) { + print "<RDWebResult>\n"; + print " <ResponseCode>" . $responsecode . "</ResponseCode>\n"; + print " <ErrorString>" . $errorstring . "</ErrorString>\n"; + print "</RDWebResult>\n"; +} else { + print "<dropboxList>\n"; + for my $href (@dropboxes) { + print " <dropbox>\n"; + print " <group>" . $href->{'GROUP'} . "</group>\n"; + print " <group-description>" . $href->{'GROUPDESC'} . "</group-description>\n"; + print " <type>" . $href->{'TYPE'} . "</type>\n"; + print " <showid>" . $href->{'SHOWID'} . "</showid>\n"; + print " <normalization-level>" . $href->{'NORMLEVEL'} . "</normalization-level>\n"; + print " <autotrim-level>" . $href->{'TRIMLEVEL'} . "</autotrim-level>\n"; + print " <parameters>" . $href->{'PARAM'} . "</parameters>\n"; + if($href->{'TYPE'} eq "show") { + print " <show-title>" . $href->{'SHOWTITLE'} . "</show-title>\n"; + print " <show-rhythm>" . $href->{'RHYTHM'} . "</show-rhythm>\n"; + print " <show-dayofweek>" . $href->{'DOW'} . "</show-dayofweek>\n"; + print " <show-starttime>" . $href->{'STARTTIME'} . "</show-starttime>\n"; + print " <show-length>" . $href->{'LENGTH'} . "</show-length>\n"; + } + print " </dropbox>\n"; + } + print "</dropboxList>\n"; +} |