summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-11-25 21:52:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-11-25 21:52:08 (GMT)
commitb40c235c699e737431ded7c4ccdc57c5c80be770 (patch)
treed697a81e8bc73c493f5132b6af74eff6cb85c14a /lib
parent1eab56a6601fc41643cdc3d9372462edf3f5000d (diff)
implemented show types
Diffstat (limited to 'lib')
-rwxr-xr-xlib/RHRD/rddb.pm14
-rwxr-xr-xlib/RHRD/utils.pm29
2 files changed, 37 insertions, 6 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm
index f89682a..e9f79ef 100755
--- a/lib/RHRD/rddb.pm
+++ b/lib/RHRD/rddb.pm
@@ -1237,6 +1237,8 @@ sub get_dropboxes
$entry->{'SHOWSTARTTIME'} = '????' unless((RHRD::utils::dropbox_param_starttime_ok($entry->{'SHOWSTARTTIME'}))[0]);
$entry->{'SHOWLEN'} = $p[4];
$entry->{'SHOWLEN'} = 0 unless((RHRD::utils::dropbox_param_len_ok($entry->{'SHOWLEN'}))[0]);
+ $entry->{'SHOWTYPE'} = $p[5];
+ $entry->{'SHOWTYPE'} = 'n' unless((RHRD::utils::dropbox_param_showtype_ok($entry->{'SHOWTYPE'}))[0]);
} elsif(defined($p[0]) && $p[0] eq "J") {
$entry->{'TYPE'} = 'jingle';
$entry->{'JINGLETITLE'} = $groupdesc;
@@ -1452,6 +1454,8 @@ sub list_shows
substr($p[3], 2, 0) = ':';
$entry->{'STARTTIME'} = $p[3];
$entry->{'LEN'} = int $p[4];
+ $entry->{'TYPE'} = 'n';
+ $entry->{'TYPE'} = $p[5] if(defined($p[5]));
push @show_dbs, $entry;
}
@@ -1712,6 +1716,8 @@ sub get_show_info
substr($p[3], 2, 0) = ':';
$entry->{'STARTTIME'} = $p[3];
$entry->{'LEN'} = int $p[4];
+ $entry->{'TYPE'} = 'n';
+ $entry->{'TYPE'} = $p[5] if(defined($p[5]));
return ($entry, 'OK', 'success');
}
@@ -1920,8 +1926,8 @@ sub create_show_macro_cart
sub create_show_dropbox
{
- my ($ctx, $groupname, $showid, $rhythm, $dow, $starttime, $len) = @_;
- my $param = join(';', ('S', $rhythm, $dow, $starttime, $len));
+ my ($ctx, $groupname, $showid, $rhythm, $dow, $starttime, $len, $type) = @_;
+ my $param = join(';', ('S', $rhythm, $dow, $starttime, $len, $type));
my $sql = qq{insert into DROPBOXES (STATION_NAME, GROUP_NAME, NORMALIZATION_LEVEL, AUTOTRIM_LEVEL, TO_CART, FIX_BROKEN_FORMATS, SET_USER_DEFINED) values (?, ?, ?, ?, ?, 'Y', ?)};
@@ -1938,8 +1944,8 @@ sub create_show_dropbox
sub update_show_dropbox
{
- my ($ctx, $showid, $rhythm, $dow, $starttime, $len) = @_;
- my $param = join(';', ('S', $rhythm, $dow, $starttime, $len));
+ my ($ctx, $showid, $rhythm, $dow, $starttime, $len, $type) = @_;
+ my $param = join(';', ('S', $rhythm, $dow, $starttime, $len, $type));
my $sql = qq{update DROPBOXES set SET_USER_DEFINED = ? where TO_CART = ?};
diff --git a/lib/RHRD/utils.pm b/lib/RHRD/utils.pm
index 63e51c4..834f9fa 100755
--- a/lib/RHRD/utils.pm
+++ b/lib/RHRD/utils.pm
@@ -69,6 +69,7 @@ use constant {
DB_PARAM_DOW_HINT => "must be between 1 and 7 (1=Monday, ..., 7=Sunday)",
DB_PARAM_STARTTIME_HINT => "must be in format HHMM (without seperator) in 24 hour format",
DB_PARAM_LEN_HINT => "must be a positive number below 1440",
+ DB_PARAM_SHOWTYPE_HINT => "only n, r and s are allowed with n -> normal, r -> re-run, s -> special",
CMDLINE_WEEK_HINT => "must be one of W1, W2, W3, W4",
CMDLINE_DOW_HINT => "must be one of MO, TU, WE, TH, FR, SA, SU",
@@ -103,8 +104,8 @@ sub dropbox_param_type_ok
{
my ($type) = @_;
- unless(defined($type) && ($type == 'S' || $type == 'M' || $type == 'J')) {
- return (0, "unkown type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_TYPE_HINT);
+ unless(defined($type) && ($type eq 'S' || $type eq 'M' || $type eq 'J')) {
+ return (0, "unknown type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_TYPE_HINT);
}
return (1, 'OK', DB_PARAM_TYPE_HINT);
}
@@ -149,6 +150,30 @@ sub dropbox_param_len_ok
return (1, 'OK', DB_PARAM_LEN_HINT);
}
+sub dropbox_param_showtype_ok
+{
+ my ($type) = @_;
+
+ unless(defined($type) && ($type eq 'n' || $type eq 'r' || $type eq 's')) {
+ return (0, "unknown show-type '" . (defined($type) ? $type : 'undef') . "'", DB_PARAM_SHOWTYPE_HINT);
+ }
+ return (1, 'OK', DB_PARAM_SHOWTYPE_HINT);
+}
+
+sub dropbox_param_showtype_to_string
+{
+ my ($type) = @_;
+
+ if($type eq 'n') {
+ return "regular";
+ } elsif($type eq 'r') {
+ return "re-run";
+ } elsif($type eq 's') {
+ return "special";
+ }
+ return "invalid show-type!";
+}
+
sub cmdline_rdweek
{
my ($dow) = @_;