diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-12-03 21:10:22 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-12-03 21:10:22 (GMT) |
commit | 118522ced59b522713bde5147286a102f90d72ea (patch) | |
tree | 2eec7e915d62126cad24c44fffa625970499e686 | |
parent | 4c180691b640ae416239f1bcd375ea513cf5d50b (diff) |
improve show param normalization
-rwxr-xr-x | lib/RHRD/rddb.pm | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 83a5f5b..3b17a27 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -1232,9 +1232,10 @@ sub get_dropboxes $entry->{'SHOWRHYTHM'} = $p[1]; $entry->{'SHOWRHYTHM'} = '????' unless((RHRD::utils::dropbox_param_rhythm_ok($entry->{'SHOWRHYTHM'}))[0]); $entry->{'SHOWDOW'} = $p[2]; - $entry->{'SHOWDOW'} = 0 unless((RHRD::utils::dropbox_param_dow_ok($entry->{'SHOWDOW'}))[0]); + $entry->{'SHOWDOW'} = -1 unless((RHRD::utils::dropbox_param_dow_ok($entry->{'SHOWDOW'}))[0]); $entry->{'SHOWSTARTTIME'} = $p[3]; $entry->{'SHOWSTARTTIME'} = '????' unless((RHRD::utils::dropbox_param_starttime_ok($entry->{'SHOWSTARTTIME'}))[0]); + substr($entry->{'SHOWSTARTTIME'}, 2, 0) = ':'; $entry->{'SHOWLEN'} = $p[4]; $entry->{'SHOWLEN'} = 0 unless((RHRD::utils::dropbox_param_len_ok($entry->{'SHOWLEN'}))[0]); $entry->{'SHOWTYPE'} = $p[5]; @@ -1448,14 +1449,20 @@ sub list_shows $entry->{'GROUP'} = $group; $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->{'RHYTHM'} = '????' unless((RHRD::utils::dropbox_param_rhythm_ok($entry->{'RHYTHM'}))[0]); + $entry->{'DOW'} = $p[2]; + $entry->{'DOW'} = -1 unless((RHRD::utils::dropbox_param_dow_ok($entry->{'DOW'}))[0]); + $entry->{'DOW'} = int $entry->{'DOW'}; $entry->{'STARTTIME'} = $p[3]; - $entry->{'LEN'} = int $p[4]; - $entry->{'TYPE'} = 'n'; - $entry->{'TYPE'} = $p[5] if(defined($p[5])); + $entry->{'STARTTIME'} = '????' unless((RHRD::utils::dropbox_param_starttime_ok($entry->{'STARTTIME'}))[0]); + substr($entry->{'STARTTIME'}, 2, 0) = ':'; + $entry->{'LEN'} = $p[4]; + $entry->{'LEN'} = 0 unless((RHRD::utils::dropbox_param_len_ok($entry->{'LEN'}))[0]); + $entry->{'LEN'} = int $entry->{'LEN'}; + $entry->{'TYPE'} = $p[5]; + $entry->{'TYPE'} = 'n' unless((RHRD::utils::dropbox_param_showtype_ok($entry->{'TYPE'}))[0]); push @show_dbs, $entry; } @@ -1710,14 +1717,20 @@ sub get_show_info $entry->{'GROUP'} = $group; $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->{'RHYTHM'} = '????' unless((RHRD::utils::dropbox_param_rhythm_ok($entry->{'RHYTHM'}))[0]); + $entry->{'DOW'} = $p[2]; + $entry->{'DOW'} = -1 unless((RHRD::utils::dropbox_param_dow_ok($entry->{'DOW'}))[0]); + $entry->{'DOW'} = int $entry->{'DOW'}; $entry->{'STARTTIME'} = $p[3]; - $entry->{'LEN'} = int $p[4]; - $entry->{'TYPE'} = 'n'; - $entry->{'TYPE'} = $p[5] if(defined($p[5])); + $entry->{'STARTTIME'} = '????' unless((RHRD::utils::dropbox_param_starttime_ok($entry->{'STARTTIME'}))[0]); + substr($entry->{'STARTTIME'}, 2, 0) = ':'; + $entry->{'LEN'} = $p[4]; + $entry->{'LEN'} = 0 unless((RHRD::utils::dropbox_param_len_ok($entry->{'LEN'}))[0]); + $entry->{'LEN'} = int $entry->{'LEN'}; + $entry->{'TYPE'} = $p[5]; + $entry->{'TYPE'} = 'n' unless((RHRD::utils::dropbox_param_showtype_ok($entry->{'TYPE'}))[0]); return ($entry, 'OK', 'success'); } @@ -2052,6 +2065,7 @@ sub list_multi_shows $entry->{'TITLE'} = $title; $entry->{'SHOWS'} = {}; $entry->{'TYPE'} = $type; + $entry->{'TYPE'} = 'n' unless((RHRD::utils::dropbox_param_showtype_ok($entry->{'TYPE'}))[0]); my @showlist = split(';', $shows); foreach my $show (@showlist) { @@ -2172,6 +2186,7 @@ sub get_multi_show_info $entry->{'TITLE'} = $title; $entry->{'SHOWS'} = {}; $entry->{'TYPE'} = $type; + $entry->{'TYPE'} = 'n' unless((RHRD::utils::dropbox_param_showtype_ok($entry->{'TYPE'}))[0]); my @showlist = split(';', $shows); foreach my $show (@showlist) { |