From 9144cc5b0658074fe5ec2bc51172630620d17073 Mon Sep 17 00:00:00 2001 From: Mischa Spelt Date: Mon, 4 Jan 2021 20:55:54 +0100 Subject: [PATCH] Bug fix on air.txt --- .../Http/Controllers/ProgramController.php | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/api/app/Http/Controllers/ProgramController.php b/api/app/Http/Controllers/ProgramController.php index 132c211..6716650 100644 --- a/api/app/Http/Controllers/ProgramController.php +++ b/api/app/Http/Controllers/ProgramController.php @@ -281,15 +281,16 @@ QUERY; $activeStudioQuery = app('db')->select("SELECT `studio` FROM `programs_schedule_webcam` WHERE `active` = 1"); if(!count($activeStudioQuery) || !($activeStudio = $activeStudioQuery[0]->studio)) { - $activeStudio = 'nonstop'; - } - - $current = $this->getTrack($activeStudio); - $next = $this->getTrack($activeStudio, /* next: */ true); - $current->ends($next->start); - if($current->isLayout() /* || $current->secondsRemaining() < 0 */) { - if(!$next->isLayout()) { - $current = $next; + $activeStudio = null; + $current = null; + } else { + $current = $this->getTrack($activeStudio); + $next = $this->getTrack($activeStudio, /* next: */ true); + $current->ends($next->start); + if($current->isLayout() /* || $current->secondsRemaining() < 0 */) { + if(!$next->isLayout()) { + $current = $next; + } } } @@ -314,7 +315,7 @@ QUERY; $activeStudioQuery = app('db')->select("SELECT `studio` FROM `programs_schedule_webcam` WHERE `active` = 1"); if(!count($activeStudioQuery) || !($activeStudio = $activeStudioQuery[0]->studio)) { - $activeStudio = 'nonstop'; + $activeStudio = $program->nonstop ? 'nonstop' : null; } $text = []; @@ -332,7 +333,7 @@ QUERY; } } - if(!$request->get('program_only', false) && !($current->isLayout())) { + if($current && !$request->get('program_only', false) && !($current->isLayout())) { if($current->title) $text[] = $current->title; if($current->artist) $text[] = $currenet->artist; }