summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/control2
-rwxr-xr-xutils/rhrd-schedules21
2 files changed, 16 insertions, 7 deletions
diff --git a/debian/control b/debian/control
index b185e24..891bb2b 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Standards-Version: 3.9.6
Package: librhrd-perl
Architecture: all
-Depends: ${misc:Depends}, ${perl:Depends}, libconfig-inifiles-perl, libdbi-perl, libdbd-mysql-perl, libdate-calc-perl, libdatetime-perl, libdatetime-timezone-perl, libjson-any-perl, liburi-perl, libwww-perl
+Depends: ${misc:Depends}, ${perl:Depends}, libconfig-inifiles-perl, libdbi-perl, libdbd-mysql-perl, libdate-calc-perl, libdatetime-perl, libdatetime-timezone-perl, libdatetime-format-strptime-perl, libjson-any-perl, liburi-perl, libwww-perl
Description: Radio Helsinki Rivendell Perl Modules
These modules are used by rhwebimport, rhimport as well by
some other scripts.
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";
}
}