summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rhrd-schedules26
1 files changed, 19 insertions, 7 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index 3579821..6904154 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -27,6 +27,7 @@ use lib "../lib/";
use RHRD::rddb;
use RHRD::utils;
+use DateTime;
use Date::Calc;
sub print_usage
@@ -68,6 +69,7 @@ sub show__day
}
my $dow = Date::Calc::Day_of_Week(@date);
+ my $week = RHRD::utils::get_rd_week(DateTime->new(year => $date[0], month => $date[1], day => $date[2], hour => 12));
my $errcnt = 0;
for my $entry (@{$data}) {
@@ -80,16 +82,26 @@ sub show__day
print " $start: ($showid) -> ";
if($showid > 0) {
- my ($rdtitle, $rdlog, $status, $errorstring) = RHRD::rddb::get_show_title_and_log($ctx, $showid);
- if(!defined $rdtitle || !defined $rdlog) {
+ my ($show, $status, $errorstring) = RHRD::rddb::get_show_info($ctx, $showid);
+ if(!defined $show) {
print "$status: $errorstring\n";
$errcnt++;
- } elsif ($title ne $rdtitle) {
- print "WARNING: title mismatch (PV: '$title' != RD: '$rdtitle')\n";
- $errcnt++;
} else {
- # TODO: check DayOfWeek!!!
- print "OK: $title\n";
+ my @weeks = split('', ${$show}{'RHYTHM'});
+ if ($title ne ${$show}{'TITLE'}) {
+ print "WARNING: title mismatch (PV: '$title' != RD: '" . ${$show}{'TITLE'} . "')\n";
+ $errcnt++;
+ } elsif ($dow != ${$show}{'DOW'}) {
+ print "WARNING: wrong day of week (PV: " . Date::Calc::Day_of_Week_to_Text($dow) . " != RD: " . Date::Calc::Day_of_Week_to_Text(${$show}{'DOW'}) . ")\n";
+ $errcnt++;
+ } elsif ($weeks[$week-1] != '1') {
+ print "WARNING: this is week $week but show rhythm is: " . ${$show}{'RHYTHM'} . " -> show shouldn't air in this week!\n";
+ $errcnt++;
+ } else {
+ # TODO: check for STARTTIME
+ # TODO: check for LEN (missing endtime in pv export...)
+ print "OK: $title\n";
+ }
}
} else {
print "ERROR: show '$pvid|$title' not configured\n";