summaryrefslogtreecommitdiff
path: root/utils/rhrd-schedules
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2016-04-27 15:34:02 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2016-04-27 15:34:02 (GMT)
commit29e5b192b58cd020ce44b0c8b19bd5ac73b2cfb4 (patch)
tree4ed28289688955083317a269ae34966e654ee364 /utils/rhrd-schedules
parentec629f278662cc3323bac49ffc5d19bc0cf57a5e (diff)
generating schedule logs works now
Diffstat (limited to 'utils/rhrd-schedules')
-rwxr-xr-xutils/rhrd-schedules20
1 files changed, 17 insertions, 3 deletions
diff --git a/utils/rhrd-schedules b/utils/rhrd-schedules
index 1021b76..f6d60ae 100755
--- a/utils/rhrd-schedules
+++ b/utils/rhrd-schedules
@@ -24,7 +24,6 @@ use strict;
# TODO: remove me!!!
use lib "../lib/";
-use Data::Dumper::Simple;
use RHRD::rddb;
use RHRD::utils;
@@ -48,22 +47,37 @@ sub generate
return 1;
}
+ my @shows = ();
for my $entry (@{$data}) {
my $start = DateTime::Format::Strptime::strptime("%Y-%m-%d_%H:%M:%S", ${$entry}{'start'});
my $title = ${$entry}{'title'};
my $pvid = ${$entry}{'id'};
my $showid = ${$entry}{'automation-id'};
+ next if $pvid == 1; # 'Unmoderiertes Musikprogramm'
+
if($start->year != $year || $start->month != $month || $start->day != $day) {
print "WARNING: skipping entry whith invalid start -> $start: $title ($pvid)\n";
next;
}
+ if($showid < 0) {
+ print "WARNING: skipping entry whith invalid/unset automation id -> $start: $title ($pvid)\n";
+ next;
+ }
+
# Rivendell has problems with events starting at midnight
if($start->hour == 0 && $start->minute == 0 && $start->second == 0) {
$start->set_second(1);
}
- print "$start: $showid\n";
+ my $show = {};
+ $show->{'ID'} = $showid;
+ $show->{'START_TIME'} = ($start->hour * 3600) + ($start->minute * 60) + $start->second;
+ push @shows, $show;
+ }
+ my ($result, $status, $errorstring) = RHRD::rddb::create_schedule_log($ctx, $year, $month, $day, @shows);
+ unless(defined $result) {
+ print "$status: $errorstring\n";
+ return 1;
}
- # TODO: create day log in rddb
return 0;
}