onair.txt versie gemaakt
This commit is contained in:
@@ -271,7 +271,7 @@ QUERY;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Programmas nu en straks (24 uur vooruit)
|
* Huidige programma of nummer
|
||||||
*/
|
*/
|
||||||
public function onair() {
|
public function onair() {
|
||||||
$start = new \DateTimeImmutable('now');
|
$start = new \DateTimeImmutable('now');
|
||||||
@@ -284,10 +284,9 @@ QUERY;
|
|||||||
$next = $this->getTrack(/* next: */ true);
|
$next = $this->getTrack(/* next: */ true);
|
||||||
$current->ends($next->start);
|
$current->ends($next->start);
|
||||||
if($current->isLayout() /* || $current->secondsRemaining() < 0 */) {
|
if($current->isLayout() /* || $current->secondsRemaining() < 0 */) {
|
||||||
if($next->isLayout()) {
|
if(!$next->isLayout()) {
|
||||||
// return response()->json(['inProgram' => true, 'program' => $program]);
|
$current = $next;
|
||||||
} else
|
}
|
||||||
$current = $next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['inProgram' => false, 'stream' => $this->isStreamEnabled(), 'current' => $current, 'program' => $program]);
|
return response()->json(['inProgram' => false, 'stream' => $this->isStreamEnabled(), 'current' => $current, 'program' => $program]);
|
||||||
@@ -297,6 +296,28 @@ QUERY;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function onair_text() {
|
||||||
|
$start = new \DateTimeImmutable('now');
|
||||||
|
$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()) {
|
||||||
|
$current = $next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $program->name . " - " . $current->title . " - " . $current->artist;
|
||||||
|
} else {
|
||||||
|
return $program->name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Programmas nu en straks (24 uur vooruit)
|
* Programmas nu en straks (24 uur vooruit)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ $app->get('podcast/download/{id:\d+}/{title}', 'PodcastController@download' );
|
|||||||
$app->get('podcast/stream/{id:\d+}/{title}', 'PodcastController@stream' );
|
$app->get('podcast/stream/{id:\d+}/{title}', 'PodcastController@stream' );
|
||||||
|
|
||||||
$app->get('programma/schema/onair', 'ProgramController@onair' );
|
$app->get('programma/schema/onair', 'ProgramController@onair' );
|
||||||
|
$app->get('programma/schema/onair.txt', 'ProgramController@onair_text' );
|
||||||
$app->get('programma/schema/nustraks', 'ProgramController@comingup' );
|
$app->get('programma/schema/nustraks', 'ProgramController@comingup' );
|
||||||
$app->get('programma/schema/recent', 'ProgramController@recent' );
|
$app->get('programma/schema/recent', 'ProgramController@recent' );
|
||||||
$app->get('programma/schema/week[/{shiftWeeks:-?\d+}]', 'ProgramController@schedule' );
|
$app->get('programma/schema/week[/{shiftWeeks:-?\d+}]', 'ProgramController@schedule' );
|
||||||
|
|||||||
Reference in New Issue
Block a user