summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-09-15 14:26:46 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-09-15 14:26:46 (GMT)
commit3bf65f5733177b0624bb4f08f9c9ba295f0336f7 (patch)
treec77183ea3835d3b5503faa5b36441d6931848a31
parent36a30c688eea7a9a14823de1ae0ec3d5128d8a72 (diff)
rhrd-schedules generate supports multi-show as well
-rwxr-xr-xutils/rhrd-schedules34
1 files changed, 24 insertions, 10 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index 9147e64..b198a9e 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -22,7 +22,6 @@
use strict;
-use lib '../lib';
use RHRD::rddb;
use RHRD::utils;
use DateTime;
@@ -46,13 +45,18 @@ sub generate
return 1;
}
+ my $week = RHRD::utils::get_rd_week(DateTime->new(year => $year, month => $month, day => $day, hour => 12));
+
my ($showid_min, $showid_max, $errorstring) = RHRD::rddb::get_showid_range($ctx);
unless(defined $showid_min) {
print STDERR "$showid_max: $errorstring\n";
return 1;
}
-
- ## TODO: get multi-show id range as well
+ (my $mshowid_min, my $mshowid_max, $errorstring) = RHRD::rddb::get_multi_showid_range($ctx);
+ unless(defined $mshowid_min) {
+ print STDERR $mshowid_max . ": " . $errorstring . "\n";
+ return 1;
+ }
my $errcnt = 0;
my @shows = ();
@@ -68,25 +72,35 @@ sub generate
next if ($start->year != $year || $start->month != $month || $start->day != $day);
if($showid < 0) {
- print "WARNING: skipping entry whith unset automation id -> $start: $title ($pvid)\n";
+ print "WARNING: skipping entry with unset automation id -> $start: $title ($pvid)\n";
$errcnt++;
next;
}
- ## include multi-show ranges for this check
- if ($showid < $showid_min || $showid > $showid_max) {
- print "WARNING: skipping entry whith out of range automation id ($showid) -> $start: $title ($pvid)\n";
+ if ($showid >= $mshowid_min && $showid <= $mshowid_max) {
+ my ($show, $status, $errorstring) = RHRD::rddb::get_multi_show_info($ctx, $showid);
+ unless(defined $show) {
+ print "WARNING: skipping entry with multi-show ($showid), reason: $errorstring -> $start: $title ($pvid)\n";
+ next;
+ }
+ my $realshowid = $show->{'SHOWS'}->{$week};
+ unless($showid > 0) {
+ print "WARNING: skipping entry with multi-show ($showid) that has no entry for Week $week -> $start: $title ($pvid)\n";
+ next
+ }
+ #print "multi: mapping $showid to $realshowid\n";
+ $showid = $realshowid;
+ } elsif ($showid < $showid_min || $showid > $showid_max) {
+ print "WARNING: skipping entry with out-of-range automation id ($showid) -> $start: $title ($pvid)\n";
next;
}
- ## if is-multi-show: get real show-id from multi-show...
-
(my $exists, my $status, $errorstring) = RHRD::rddb::check_show_exists($ctx, $showid);
unless(defined $exists) {
print STDERR "$status: $errorstring\n";
return 1;
}
if($exists != 1) {
- print "WARNING: skipping entry whith not existing automation id ($showid) -> $start: $title ($pvid)\n";
+ print "WARNING: skipping entry with not existing automation id ($showid) -> $start: $title ($pvid)\n";
next;
}