summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/rhrd-schedules21
1 files changed, 15 insertions, 6 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index 6904154..a1e2d2f 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -24,11 +24,13 @@ use strict;
# TODO: remove me!!!
use lib "../lib/";
+use Data::Dumper::Simple;
use RHRD::rddb;
use RHRD::utils;
use DateTime;
use Date::Calc;
+use DateTime::Format::Strptime;
sub print_usage
{
@@ -47,7 +49,7 @@ sub generate
}
for my $entry (@{$data}) {
- my $start = ${$entry}{'start'};
+ my $start = DateTime::Format::Strptime::strptime("%Y-%m-%d_%H:%M:%S", ${$entry}{'start'});
my $title = ${$entry}{'title'};
my $showid = ${$entry}{'id'};
print "$start: ($showid) $title\n";
@@ -73,14 +75,17 @@ sub show__day
my $errcnt = 0;
for my $entry (@{$data}) {
- my $start = ${$entry}{'start'};
+ my $start = DateTime::Format::Strptime::strptime("%Y-%m-%d_%H:%M:%S", ${$entry}{'start'});
+ my $start_short = DateTime::Format::Strptime::strftime("%H:%M", $start);
+ my $end = DateTime::Format::Strptime::strptime("%Y-%m-%d_%H:%M:%S", ${$entry}{'end'});
+ my $duration = $start->delta_ms($end);
my $title = ${$entry}{'title'};
my $pvid = ${$entry}{'id'};
my $showid = ${$entry}{'automation-id'};
next if $pvid == 1; # 'Unmoderiertes Musikprogramm'
- print " $start: ($showid) -> ";
+ print " " . DateTime::Format::Strptime::strftime("%H:%M:%S", $start) . ": ($showid) -> ";
if($showid > 0) {
my ($show, $status, $errorstring) = RHRD::rddb::get_show_info($ctx, $showid);
if(!defined $show) {
@@ -95,11 +100,15 @@ sub show__day
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";
+ print "WARNING: this is week $week but show rhythm is: " . ${$show}{'RHYTHM'} . " -> show shouldn't air in this week.\n";
+ $errcnt++;
+ } elsif ($duration->{'minutes'} != ${$show}{'LEN'}) {
+ print "WARNING: wrong show length (PV: " . $duration->minutes . " != RD: " . ${$show}{'LEN'} . ")\n";
+ $errcnt++;
+ } elsif ($start_short ne ${$show}{'STARTTIME'}) {
+ print "WARNING: wrong show start-time (PV: " . $start_short . " != RD: " . ${$show}{'STARTTIME'} . ")\n";
$errcnt++;
} else {
- # TODO: check for STARTTIME
- # TODO: check for LEN (missing endtime in pv export...)
print "OK: $title\n";
}
}