Always pass program in onAir

This commit is contained in:
2020-01-25 01:19:37 +01:00
parent d79eccd598
commit 89e7484aa2

View File

@@ -1,5 +1,4 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
@@ -261,21 +260,22 @@ QUERY;
$einde = new \DateTimeImmutable('now + 1 second');
$schema = $this->createSchedule($start, $einde);
$program = $schema['schedule'][0]['program'];
if($program->nonstop) {
$current = $this->getTrack();
$next = $this->getTrack(/* next: */ true);
$current->ends($next->start);
if($current->isLayout() /* || $current->secondsRemaining() < 0 */) {
if($next->isLayout()) {
return response()->json(['inProgram' => true, 'current' => $program->name]);
return response()->json(['inProgram' => true, 'program' => $program]);
}
$current = $next;
}
return response()->json(['inProgram' => false, 'current' => $current]);
return response()->json(['inProgram' => false, 'current' => $current, 'program' => $program]);
} else {
return response()->json(['inProgram' => true, 'current' => $program->name]);
return response()->json(['inProgram' => true, 'program' => $program]);
}
}