diff options
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-x | lib/RHRD/rddb.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index ccbff24..586ae17 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -1754,6 +1754,36 @@ sub get_musicpools_next_free_slot return get_next_free_slot($ctx, $ctx->{'config'}{'specialgroups'}{'allpools'}); } +sub list_musicpools +{ + my ($ctx) = @_; + + my $sql = qq{select DROPBOXES.GROUP_NAME,DROPBOXES.PATH,GROUPS.DESCRIPTION,DROPBOXES.SET_USER_DEFINED from DROPBOXES,GROUPS where DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ? order by DROPBOXES.PATH;}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'}) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my @pool_dbs; + while(my ($group, $shortname, $title, $params) = $sth->fetchrow_array()) { + my @p = split(';', $params); + next if ('M' ne $p[0]); + + my $entry = {}; + $entry->{'SHORTNAME'} = $shortname; + $entry->{'GROUP'} = $group; + $entry->{'TITLE'} = $title; + + push @pool_dbs, $entry; + } + $sth->finish(); + + return @pool_dbs; +} + + sub is_musicpools_user { my ($ctx, $username) = @_; |