summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-28 16:50:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-28 16:50:08 (GMT)
commitb865b96be37a6a48a4618b5bc24dbea3c6bfe311 (patch)
treec78506131e89665a80b142931d1a45760365e761
parent990e9ce17301895110e6d74546c084f772b6ab9f (diff)
implemented music pool info
-rwxr-xr-xlib/RHRD/rddb.pm31
-rwxr-xr-xutils/rhrd-pool4
2 files changed, 32 insertions, 3 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index 586ae17..68d8aaa 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -1411,9 +1411,10 @@ sub get_show_info
my ($group, $params) = $sth->fetchrow_array;
$sth->finish();
+ return (undef, 'ERROR', "show with id $showid does not exist") unless (defined $params);
my @p = split(';', $params);
- return (undef, 'ERROR', "show with $showid does not exist") unless ('S' eq $p[0]);
+ return (undef, 'ERROR', "show with id $showid does not exist") unless ('S' eq $p[0]);
my $entry = {};
$entry->{'ID'} = $showid;
@@ -1783,6 +1784,34 @@ sub list_musicpools
return @pool_dbs;
}
+sub get_musicpool_info
+{
+ my ($ctx, $shortname) = @_;
+
+ my $sql = qq{select DROPBOXES.GROUP_NAME,GROUPS.DESCRIPTION,GROUPS.DEFAULT_LOW_CART,GROUPS.DEFAULT_HIGH_CART,DROPBOXES.SET_USER_DEFINED from DROPBOXES,GROUPS where DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ? and DROPBOXES.PATH = ? 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'}, $shortname)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my ($group, $title, $low_cart, $high_cart, $params) = $sth->fetchrow_array();
+ $sth->finish();
+ return (undef, 'ERROR', "pool $shortname does not exist") unless (defined $params);
+
+ my @p = split(';', $params);
+ return (undef, 'ERROR', "pool $shortname does not exist") unless ('M' eq $p[0]);
+
+ my $entry = {};
+ $entry->{'SHORTNAME'} = $shortname;
+ $entry->{'GROUP'} = $group;
+ $entry->{'TITLE'} = $title;
+ $entry->{'LOW_CART'} = $low_cart;
+ $entry->{'HIGH_CART'} = $high_cart;
+
+ return ($entry, 'OK', 'success');
+}
sub is_musicpools_user
{
diff --git a/utils/rhrd-pool b/utils/rhrd-pool
index 6152d92..69bc702 100755
--- a/utils/rhrd-pool
+++ b/utils/rhrd-pool
@@ -58,8 +58,8 @@ sub show
print STDERR "$errorstring\n";
return 1;
}
- print $pool->{'TITLE'} . "(" . $pool->{'NUM'} . "):\n";
- print " group: " . $pool->{'GROUP'} . ", <...cart info...>\n"; # TODO print info about cart usage
+ print $pool->{'TITLE'} . " (" . $pool->{'SHORTNAME'} . "):\n";
+ print " group: " . $pool->{'GROUP'} . ", carts: " . $pool->{'LOW_CART'} . "-" . $pool->{'HIGH_CART'} . "\n"; # TODO print info about cart usage
return 0;
}