summaryrefslogtreecommitdiff
path: root/lib/RHRD
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-07-31 17:23:40 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-07-31 17:23:40 (GMT)
commit14eaf97988cf08d211bce667d091427113633864 (patch)
tree05e14b5f3eeeb90bd3fb6748adba56248089dbec /lib/RHRD
parent0a0d031e1c33411188fdd51d99ee61b0434c3742 (diff)
clock filling almost done
Diffstat (limited to 'lib/RHRD')
-rwxr-xr-xlib/RHRD/rddb.pm22
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index d0c2a47..5e6289e 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -481,7 +481,7 @@ sub fill_clock_table
my @events = @_;
$clockname = get_clock_table_name_escaped($ctx, $clockname);
- my $sql = qq{insert into $clockname (ID, EVENT_NAME, START_TIME, LENGTH) values (?, ?, ?, ?, ?);};
+ my $sql = qq{insert into $clockname (ID, EVENT_NAME, START_TIME, LENGTH) values (?, ?, ?, ?);};
my $sth = $ctx->{'dbh'}->prepare($sql)
or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr);
@@ -2203,7 +2203,21 @@ sub create_musicpool_clock
return (undef, $status, $errorstring);
}
- ## TODO: fill clock table!!!!
+ my @events = ();
+ my $t = 0;
+ for(my $i=0; $i < 24; $i++) {
+ push @events, { NAME => $shortname, START_TIME => $t, LENGTH => 142500 };
+ $t += 142500;
+ if($i > 0 && ($i % 8) == 0) {
+ $t += 60000;
+ # TODO: push jingle event
+ }
+ }
+
+ (my $next_id, $status, $errorstring) = fill_clock_table($ctx, $shortname, @events);
+ unless (defined $next_id) {
+ return (undef, $status, $errorstring);
+ }
($cnt, $status, $errorstring) = create_clockrules_table($ctx, $shortname);
unless(defined $cnt) {
@@ -2346,12 +2360,12 @@ sub remove_musicpool
push @actions, { name => 'log-event tables', cnt => ($cnt_pre + $cnt_post) };
(my $cnt_clk, $status, $errorstring) = drop_clock_table($ctx, $shortname);
- unless (defined $cnt_pre) {
+ unless (defined $cnt_clk) {
return (undef, $status, $errorstring);
}
(my $cnt_rules, $status, $errorstring) = drop_clockrules_table($ctx, $shortname);
- unless (defined $cnt_post) {
+ unless (defined $cnt_rules) {
return (undef, $status, $errorstring);
}
push @actions, { name => 'clock tables', cnt => ($cnt_clk + $cnt_rules) };