| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | our $VERSION = '0.09'; # VERSION | ||
| 7 | |||
| 8 | use Video::PlaybackMachine::DB; | ||
| 9 | use Video::PlaybackMachine::Config; | ||
| 10 | |||
| 11 | @ARGV==2 or die "Usage: $0 START_TIME DURATION\n"; | ||
| 12 | |||
| 13 | my ($start_time, $duration) = @ARGV; | ||
| 14 | |||
| 15 | MAIN: { | ||
| 16 | |||
| 17 | my $schema = Video::PlaybackMachine::DB->schema(); | ||
| 18 | my $config = Video::PlaybackMachine::Config->config(); | ||
| 19 | my $schedule = $schema->resultset('Schedule')->find({'name' => $config->schedule}); | ||
| 20 | |||
| 21 | my @results = $schedule->movie_conflicts($start_time, $duration); | ||
| 22 | |||
| 23 | if (scalar @results) { | ||
| 24 | foreach my $conflict (@results) { | ||
| 25 | print "Conflict: ", $conflict->mrl(), "\n"; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | else { | ||
| 29 | print "No conflicts.\n"; | ||
| 30 | } | ||
| 31 | |||
| 32 | } |