summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/rddb.pm51
-rwxr-xr-xlistdrobpoxes.cgi15
2 files changed, 35 insertions, 31 deletions
diff --git a/lib/rddb.pm b/lib/rddb.pm
index b8188e2..823629d 100755
--- a/lib/rddb.pm
+++ b/lib/rddb.pm
@@ -81,7 +81,7 @@ sub get_dropboxes
{
my ($dbh, $username) = @_;
- my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH,DROPBOXES.TO_CART,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME= ? and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME=GROUPS.NAME;};
+ my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH,DROPBOXES.TO_CART,DROPBOXES.NORMALIZATION_LEVEL,DROPBOXES.AUTOTRIM_LEVEL,DROPBOXES.SET_USER_DEFINED,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME= ? and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME=GROUPS.NAME;};
my $sth = $dbh->prepare($sql)
or return (undef, 'ERROR', "Database Error: " . $dbh->errstr);
@@ -90,37 +90,32 @@ sub get_dropboxes
or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
my @allowed_dbs;
- while(my ($group, $path, $to_cart, $desc) = $sth->fetchrow_array()) {
- $path =~ s/\/\*$//;
- my $name = $path;
- if($name =~ /^([0-9]{2}-[A-Za-z]+)\/([0-9]{2})([0-9]{2})-([01]{4})-([0-9]{3})\/(.*)$/) {
- $name = "$1 - $2:$3 - $6 ($4, $5)";
+ while(my ($group, $type, $showid, $normlevel, $trimlevel, $params, $groupdesc) = $sth->fetchrow_array()) {
+
+ my $entry = {};
+ $entry->{'GROUP'} = $group;
+ $entry->{'GROUPDESC'} = $groupdesc;
+ $entry->{'TYPE'} = $type;
+ $entry->{'SHOWID'} = -1;
+ $entry->{'NORMLEVEL'} = $normlevel;
+ $entry->{'TRIMLEVEL'} = $trimlevel;
+ $entry->{'PARAM'} = $params;
+ if($type eq "show") {
+ $entry->{'SHOWID'} = $showid;
+ # $params has the format: 1111-01-1600-060
+ if($params =~ /^([01]{4})-([0-9]{2})-([0-9]{2})([0-9]{2})-([0-9]{3})$/) {
+ $entry->{'RHYTHM'} = $1;
+ $entry->{'DOW'} = int $2;
+ $entry->{'STARTTIME'} = "$3:$4";
+ $entry->{'LENGTH'} = int $5;
+ }
}
- elsif($name =~ /^([0-9]{2}-[A-Za-z]+)\/jingle$/ || $name =~ /^jingles\/(.*)$/) {
- $name = "Jingles - $1";
- }
- elsif($name =~ /^pool\/pool(.*)$/) {
- $name = "Pool $1 - $desc";
- }
- elsif($name =~ /^pool\/(.*)$/) {
- $name = "Pool - $1";
- }
- elsif($name =~ /^sondersendungen\/(.*)$/) {
- $name = "Sondersendungen - $1";
- }
- elsif($name =~ /^autoimport\/(.*)$/) {
- $name = "autoimport - $1";
- }
- my $perm = {};
- $perm->{'GROUP'} = $group;
- $perm->{'PATH'} = $path;
- $perm->{'TO_CART'} = $to_cart;
- $perm->{'NAME'} = $name;
- push @allowed_dbs, $perm;
+
+ push @allowed_dbs, $entry;
}
$sth->finish();
- return sort { uc($a->{'NAME'}) cmp uc($b->{'NAME'}) } @allowed_dbs;
+ return @allowed_dbs;
}
diff --git a/listdrobpoxes.cgi b/listdrobpoxes.cgi
index f2dec4f..c1efb06 100755
--- a/listdrobpoxes.cgi
+++ b/listdrobpoxes.cgi
@@ -46,10 +46,19 @@ if($responsecode != 200) {
print "<dropboxList>\n";
for my $href (@dropboxes) {
print " <dropbox>\n";
- print " <name>" . $href->{'NAME'} . "</name>\n";
print " <group>" . $href->{'GROUP'} . "</group>\n";
- print " <path>" . $href->{'PATH'} . "</path>\n";
- print " <to_cart>" . $href->{'TO_CART'} . "</to_cart>\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-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";