Commit 6b96fa2c authored by David Trattnig's avatar David Trattnig
Browse files

Updates for fallbacks. engine#43 engine#44

parent fd2ee29c
...@@ -3,7 +3,7 @@ LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png" ...@@ -3,7 +3,7 @@ LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"
LOGO_SIZE="100px" LOGO_SIZE="100px"
API_URL="http://localhost:8008/api/v1/" API_URL="http://localhost:8008/api/v1/"
UNKNOWN_TITLE="Unknown Title" UNKNOWN_TITLE="Unknown Title"
NO_CURRENT_SCHEDULE="Right now, there's no show playing" NO_CURRENT_SCHEDULE="No show playing"
NO_NEXT_SCHEDULE="Nothing scheduled next" NO_NEXT_SCHEDULE="Nothing scheduled next"
PLAY_OFFSET=3 PLAY_OFFSET=3
CSS="" CSS=""
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
let currentTrackElement = null; let currentTrackElement = null;
let timeLeft; let timeLeft;
let scheduleTimeLeft = 0; let scheduleTimeLeft = 0;
let reloadTime = 10; let reloadTime = 100;
let reloadWait = 0; let reloadWait = 0;
// these automatically update when `time` // these automatically update when `time`
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
clockData = value; clockData = value;
console.log("Current Data", value); console.log("Current Data", value);
if (value.current_track != null) { if (value.current_track != null && value.current_track.track_duration > 0) {
let t = time - Date.parse(value.current_track.track_start); let t = time - Date.parse(value.current_track.track_start);
t = parseInt(t/1000); t = parseInt(t/1000);
timeLeft = value.current_track.track_duration - t - playoffset; timeLeft = value.current_track.track_duration - t - playoffset;
...@@ -194,10 +194,10 @@ ...@@ -194,10 +194,10 @@
/* Display the name of a show */ /* Display the name of a show */
function displayShowName(schedule) { function displayShowName(schedule, defaultText) {
let name = "" let name = ""
if (schedule == null || schedule.show_name == null) { if (schedule == null || schedule.show_name == null || schedule.show_name == "") {
name = '<span class="error">'+nonextschedule+'</span>'; name = '<span class="error">'+defaultText+'</span>';
} else { } else {
name = schedule.show_name; name = schedule.show_name;
} }
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
function displayShowSchedule(schedule) { function displayShowSchedule(schedule) {
let str = ""; let str = "";
if (schedule != null && schedule.schedule_start != null) { if (schedule != null && schedule.schedule_start != null && schedule.show_name != "") {
let scheduleStart = "" let scheduleStart = ""
let scheduleEnd = ""; let scheduleEnd = "";
...@@ -219,7 +219,7 @@ ...@@ -219,7 +219,7 @@
hour: '2-digit', hour: '2-digit',
minute:'2-digit' minute:'2-digit'
}); });
str = "" + scheduleStart; str = scheduleStart;
} }
if (schedule.schedule_end != null) { if (schedule.schedule_end != null) {
scheduleEnd = new Date(Date.parse(schedule.schedule_end)); scheduleEnd = new Date(Date.parse(schedule.schedule_end));
...@@ -238,7 +238,9 @@ ...@@ -238,7 +238,9 @@
/* Indicates if some fallback is playing */ /* Indicates if some fallback is playing */
function isFallback(current_schedule) { function isFallback(value) {
if ("current_schedule" in value)
return true;
if (current_schedule.fallback_type > 0) if (current_schedule.fallback_type > 0)
return true; return true;
return false; return false;
...@@ -247,7 +249,7 @@ ...@@ -247,7 +249,7 @@
/* Check if the given track is currently playing */ /* Check if the given track is currently playing */
function isActive(entry, currentTrack) { function isActive(entry, currentTrack) {
if (currentTrack != null && entry.track_num == currentTrack.track_num) { if (currentTrack != null && entry.track_start == currentTrack.track_start) {
return true; return true;
} }
return false; return false;
...@@ -280,7 +282,7 @@ ...@@ -280,7 +282,7 @@
#studio-clock { #studio-clock {
width: calc(100% - 200px); width: calc(100% - 200px);
height: calc(100% - 500px); height: calc(70% - 300px);
margin: 0 50px 50px 50px; margin: 0 50px 50px 50px;
display: -webkit-flex; display: -webkit-flex;
display: -ms-flexbox; display: -ms-flexbox;
...@@ -329,7 +331,7 @@ ...@@ -329,7 +331,7 @@
border: 2px solid #333; border: 2px solid #333;
margin: 20px 20px 40px 20px; margin: 20px 20px 40px 20px;
background-color: #111; background-color: #111;
height: 100%; height: 700px;
} }
#current-schedule, #current-schedule,
...@@ -347,6 +349,7 @@ ...@@ -347,6 +349,7 @@
#current-schedule .schedule-title { #current-schedule .schedule-title {
text-align: center; text-align: center;
height: 100px; height: 100px;
overflow: revert;
} }
#current-schedule .schedule-title h1 { #current-schedule .schedule-title h1 {
...@@ -369,7 +372,7 @@ ...@@ -369,7 +372,7 @@
padding: 10px; padding: 10px;
display: flex; display: flex;
align-items: center; align-items: center;
border-top: 1px solid #333;; border-top: 1px solid #333;
} }
#playlist::-webkit-scrollbar-track #playlist::-webkit-scrollbar-track
...@@ -586,13 +589,13 @@ ...@@ -586,13 +589,13 @@
<div class="schedule-title"> <div class="schedule-title">
<h1> <h1>
{#if hasValidSchedule(value)} {#if hasValidSchedule(value)}
{@html displayShowName(value.current_schedule)} {displayShowSchedule(value.current_schedule)} {@html displayShowName(value.current_schedule, nocurrentschedule)} {displayShowSchedule(value.current_schedule)}
{#if isFallback(value.current_schedule)}
<span class="fallback-indicator">{fallbacktext}</span>
{/if}
{:else} {:else}
<span class="error">{nocurrentschedule}</span> <span class="error">{nocurrentschedule}</span>
{/if} {/if}
{#if isFallback(value)}
<span class="fallback-indicator">{fallbacktext}</span>
{/if}
</h1> </h1>
</div> </div>
<div id="playlist"> <div id="playlist">
...@@ -614,7 +617,9 @@ ...@@ -614,7 +617,9 @@
<li class="playlist-entry"> <li class="playlist-entry">
<span class="track-title">{displayTitle(entry)}</span> <span class="track-title">{displayTitle(entry)}</span>
<span class="track-type">{displayType(entry)}</span> <span class="track-type">{displayType(entry)}</span>
{#if entry.track_duration > 0 }
<span class="track-duration">{formatTime(entry.track_duration)}</span> <span class="track-duration">{formatTime(entry.track_duration)}</span>
{/if}
</li> </li>
{/if} {/if}
...@@ -640,7 +645,7 @@ ...@@ -640,7 +645,7 @@
{#if value.current_schedule} {#if value.current_schedule}
<div id="next-schedule"> <div id="next-schedule">
<h3 class="schedule-title">{@html displayShowName(value.next_schedule)} {displayShowSchedule(value)}</h3> <h3 class="schedule-title">{@html displayShowName(value.next_schedule, nonextschedule)} {displayShowSchedule(value)}</h3>
</div> </div>
{/if} {/if}
{:catch error} {:catch error}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment