summaryrefslogtreecommitdiff
path: root/utils/rhrd-schedules
diff options
context:
space:
mode:
Diffstat (limited to 'utils/rhrd-schedules')
-rwxr-xr-xutils/rhrd-schedules52
1 files changed, 46 insertions, 6 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index 50dc613..8f1c2fe 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -355,18 +355,36 @@ sub orphans
return -1;
}
+ my ($showid_min, $showid_max, $errorstring) = RHRD::rddb::get_showid_range($ctx);
+ unless(defined $showid_min) {
+ print STDERR "$showid_max: $errorstring\n";
+ return -1;
+ }
my @showids = RHRD::rddb::list_showids($ctx);
if(!defined $showids[0] && defined $showids[1]) {
print STDERR "$showids[1]: $showids[2]";
return -1;
}
-
- # TODO: add multi-show-ids to the hash and omit showids who are part of a multi-show
my %shows;
for my $showid (@showids) {
$shows{$showid} = 0;
}
+ (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 @mshowlst = RHRD::rddb::list_multi_shows($ctx);
+ if(!defined $mshowlst[0] && defined $mshowlst[1]) {
+ print STDERR "$mshowlst[1]: $mshowlst[2]";
+ return -1;
+ }
+ my %mshows;
+ for my $mshow (@mshowlst) {
+ $mshows{$mshow->{'ID'}} = 0;
+ }
+
for my $date (@dates) {
my ($year, $month, $day) = @{$date};
my ($ret, $data) = RHRD::utils::fetch_parse_json("https://pv.helsinki.at/export/day_schedule/$year/$month/$day/", "rhrd-schedules");
@@ -381,21 +399,43 @@ sub orphans
my $showid = ${$entry}{'automation-id'};
next if $pvid == 1; # 'Unmoderiertes Musikprogramm'
- # maybe only the end is on this day - we don't need this to include in the log since only
- # start times matter here.
+ # maybe only the end is on this day - we don't need this since only start times matter here.
next if ($start->year != $year || $start->month != $month || $start->day != $day);
if($showid < 0) {
next;
}
- $shows{$showid}++;
+ if($showid >= $showid_min && $showid <= $showid_max) {
+ $shows{$showid}++;
+ } elsif($showid >= $mshowid_min && $showid <= $mshowid_max) {
+ $mshows{$showid}++;
+ } else {
+ print STDERR "Error got invalid automation-id from PV (PV: $pvid, RD: $showid)\n";
+ }
+ }
+ }
+
+ for my $mshowid (sort keys %mshows) {
+ my ($show, $status, $errorstring) = RHRD::rddb::get_multi_show_info($ctx, $mshowid);
+ unless(defined $show) {
+ print STDERR "WARNING: skipping entry with multi-show ($mshowid), reason: $errorstring\n";
+ next;
+ }
+ for my $week (keys %{$show->{'SHOWS'}}) {
+ my $showid = $show->{'SHOWS'}->{$week};
+ if($showid > 0) {
+ $shows{$showid}++;
+ }
+ }
+
+ if($mshows{$mshowid} == 0) {
+ print "$mshowid: " . ${$show}{'TITLE'} . "\n";
}
}
for my $showid (sort keys %shows) {
if($shows{$showid} == 0) {
- ## TODO: if $showid is inside multi-range -> get info from there
my ($show, $status, $errorstring) = RHRD::rddb::get_show_info($ctx, $showid);
if(!defined $show) {
print "$status: $errorstring\n";