summaryrefslogtreecommitdiff
path: root/lib/RHRD/rddb.pm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-04-15 20:43:20 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2016-04-15 20:43:20 (GMT)
commiteec0aa47e2d9ee49f57160b238a70cc81aa3f744 (patch)
tree76da91d90bcc903fb75e51ab185ab72f91328eb5 /lib/RHRD/rddb.pm
parentd1016e1e09bf460ede1ac49e91650351b3aff4a4 (diff)
added some more checks: dow, week-rhythm...
Diffstat (limited to 'lib/RHRD/rddb.pm')
-rwxr-xr-xlib/RHRD/rddb.pm37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index f9bcb87..380a486 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -999,7 +999,7 @@ sub list_shows
}
my @show_dbs;
- while(my ($to_cart, $params, $lowcart, $highcart) = $sth->fetchrow_array()) {
+ while(my ($to_cart, $params) = $sth->fetchrow_array()) {
my @p = split(';', $params);
next if ('S' ne $p[0]);
@@ -1206,6 +1206,41 @@ sub get_show_title_and_log
return ($title, $log, 'OK', 'success');
}
+sub get_show_info
+{
+ my ($ctx, $showid) = @_;
+
+ my $sql = qq{select SET_USER_DEFINED from DROPBOXES where STATION_NAME = ? and TO_CART = ?;};
+
+ my $sth = $ctx->{'dbh'}->prepare($sql)
+ or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
+
+ $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'}, $showid)
+ or return (undef, 'ERROR', "Database Error: " . $sth->errstr);
+
+ my ($params) = $sth->fetchrow_array;
+ $sth->finish();
+
+ my @p = split(';', $params);
+ return (undef, 'ERROR', "show with $showid does not exist") unless ('S' eq $p[0]);
+
+ my $entry = {};
+ $entry->{'ID'} = $showid;
+ my ($title, $log, $status, $errorstring) = get_show_title_and_log($ctx, $showid);
+ return (undef, $status, $errorstring) unless (defined $title && defined $log);
+
+ $entry->{'TITLE'} = $title;
+ $entry->{'LOG'} = $log;
+ $entry->{'RHYTHM'} = $p[1];
+ $entry->{'DOW'} = int $p[2];
+ $entry->{'DOW'} = 0 unless $entry->{'DOW'} < 7;
+ substr($p[3], 2, 0) = ':';
+ $entry->{'STARTTIME'} = $p[3];
+ $entry->{'LEN'} = int $p[4];
+
+ return ($entry, 'OK', 'success');
+}
+
sub get_show_carts
{
my ($ctx, $showid) = @_;