diff options
-rwxr-xr-x | lib/RHRD/rddb.pm | 20 | ||||
-rwxr-xr-x | utils/rd-show | 8 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index d87acb7..7937643 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -61,6 +61,8 @@ sub init @{$ctx{'config'}{'specialusers'}{'allpools'}} = split(' ', $cfg->val('specialusers', 'allpools', '')); $ctx{'config'}{'dropboxes'}{'dropbox-pseudo-station'} = $cfg->val('dropboxes', 'dropbox-pseudo-station', 'import-dropbox'); + $ctx{'config'}{'dropboxes'}{'norm-level'} = $cfg->val('dropboxes', 'norm-level', -1200); + $ctx{'config'}{'dropboxes'}{'trim-level'} = $cfg->val('dropboxes', 'trim-level', 0); $ctx{'config'}{'shows'}{'service'} = $cfg->val('shows', 'service', ''); $ctx{'config'}{'shows'}{'defaultuser'} = $cfg->val('shows', 'defaultuser', ''); @@ -1093,6 +1095,24 @@ sub create_show_macro_cart return ($number, 'OK', 'success'); } +sub create_show_dropbox +{ + my ($ctx, $groupname, $show_id, $rhythm, $dow, $starttime, $len) = @_; + my $param = join(';', ('S', $rhythm, $dow, $starttime, $len)); + + my $sql = qq{insert into DROPBOXES (STATION_NAME, GROUP_NAME, NORMALIZATION_LEVEL, AUTOTRIM_LEVEL, TO_CART, FIX_BROKEN_FORMATS, SET_USER_DEFINED) values (?, ?, ?, ?, ?, 'Y', ?)}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + my $cnt = $sth->execute($ctx->{'config'}{'dropboxes'}{'dropbox-pseudo-station'}, $groupname, $ctx->{'config'}{'dropboxes'}{'norm-level'}, $ctx->{'config'}{'dropboxes'}{'trim-level'}, $show_id, $param) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + $sth->finish(); + + return ($cnt, 'OK', 'success'); +} + ########################### MUSICPOOL handling ########################### sub get_musicpools_cart_range diff --git a/utils/rd-show b/utils/rd-show index 0a0bc1e..3d54630 100755 --- a/utils/rd-show +++ b/utils/rd-show @@ -244,8 +244,12 @@ sub add } print " * created macro cart -> new show-id = " . $show_id . "\n"; - # TODO: - # create dropbox for: groupname, show-id, rhythm, dow, starttime, len + ($result, $status, $errorstring) = RHRD::rddb::create_show_dropbox($ctx, $groupname, $show_id, $rhythm, $dow, $starttime, $len); + unless(defined $result) { + print STDERR $status . ": " . $errorstring . "\n"; + return 1; + } + print " * created dropbox for show .. " . $result . " rows affected\n"; print " * finished\n"; |