Commit e91907b1 authored by david's avatar david
Browse files

Adaptation to API. #1

parent 14b8535f
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<script> <script>
import { onMount } from 'svelte'; import { onMount } from 'svelte';
export let css = ""; export let css = "";
export let api = "http://localhost:3333/api/v1"; export let api = "http://localhost:8008/api/v1";
export let name = "Studio Clock"; export let name = "Studio Clock";
export let logo = "https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"; export let logo = "https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png";
export let logosize = "100px"; export let logosize = "100px";
...@@ -75,13 +75,13 @@ ...@@ -75,13 +75,13 @@
loadExternalCss(rootElement, css); loadExternalCss(rootElement, css);
/* Set currently loaded data */ /* Set currently loaded data */
if (currentTrack == null && info != null && info.track != null) { if (currentTrack == null && info != null && info.current_track != null) {
currentTrack = info; currentTrack = info;
let t = time - Date.parse(info.track_start); let t = time - Date.parse(info.current_track.track_start);
t = parseInt(t/1000); t = parseInt(t/1000);
timeLeft = info.track.duration - t - 3; /* FIXME improve timings in coordination with scheduler/trackservice/LQS */ timeLeft = info.current_track.track_duration - t - 3; /* FIXME improve timings in coordination with scheduler/trackservice/LQS */
console.log("Current Data", info); console.log("Current Data", info);
} }
return ""; return "";
...@@ -90,9 +90,9 @@ ...@@ -90,9 +90,9 @@
function displayTitle(track) { function displayTitle(track) {
if (track != null) { if (track != null) {
let artist = ""; let artist = "";
if (track.artist != "") if (track.track_artist != "")
artist = track.artist + " - "; artist = track.track_artist + " - ";
return artist + track.title; return artist + track.track_title;
} }
return ""; return "";
} }
...@@ -112,12 +112,12 @@ ...@@ -112,12 +112,12 @@
return ""; return "";
} }
function displayShowName(show) { function displayShowName(schedule) {
let name = "" let name = ""
if (show == null || show.name == null) { if (schedule == null || schedule.show_name == null) {
name = '<span class="error">'+noScheduleMessage+'</span>'; name = '<span class="error">'+noScheduleMessage+'</span>';
} else { } else {
name = show.name; name = schedule.show_name;
} }
return name; return name;
} }
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
} }
function isActive(entry, currentTrack) { function isActive(entry, currentTrack) {
if (currentTrack != null && entry.id == currentTrack.id) { if (currentTrack != null && entry.track_num == currentTrack.track_num) {
// Scroll to current playlist entry // Scroll to current playlist entry
location.hash = "#current-playlist-entry"; location.hash = "#current-playlist-entry";
return true; return true;
...@@ -339,9 +339,9 @@ ...@@ -339,9 +339,9 @@
stroke: rgb(180,0,0); stroke: rgb(180,0,0);
} }
.second-counterweight { /* .second-counterweight {
/* stroke-width: 3; */ stroke-width: 3;
} } */
footer { footer {
width: 100%; width: 100%;
...@@ -429,19 +429,19 @@ ...@@ -429,19 +429,19 @@
{:then value} {:then value}
{initComponent(value)} {initComponent(value)}
{#if value.current.show} {#if value.current_schedule}
<div id="current-schedule"> <div id="current-schedule">
<h1 class="schedule-title">{@html displayShowName(value.current.show)} {displayShowSchedule(value.current)}</h1> <h1 class="schedule-title">{@html displayShowName(value.current_schedule)} {displayShowSchedule(value.current_schedule)}</h1>
<!-- <div class="schedule-details"> <!-- <div class="schedule-details">
<b>Type:</b> {value.current.show.type}, <b>Host:</b> {value.current.show.host}</div>--> <b>Type:</b> {value.current_schedule}, <b>Host:</b> {value.current_schedule}</div>-->
</div> </div>
<div id="playlist"> <div id="playlist">
{#if value.current.playlist} {#if value.current_playlist}
<ol> <ol>
{#each value.current.playlist.entries as entry, index} {#each value.current_playlist.entries as entry, index}
{#if isActive(entry, value.track)} {#if isActive(entry, value.current_track)}
<li id="current-playlist-entry" class="playlist-entry is-active"> <li id="current-playlist-entry" class="playlist-entry is-active">
<!-- <span class="play-icon">&#9654;</span> --> <!-- <span class="play-icon">&#9654;</span> -->
...@@ -471,7 +471,7 @@ ...@@ -471,7 +471,7 @@
{/if} {/if}
</div> </div>
<div id="next-schedule"> <div id="next-schedule">
<h3 class="schedule-title">Next: {@html displayShowName(value.next.show)} {displayShowSchedule(value)}</h3> <h3 class="schedule-title">Next: {@html displayShowName(value.next_schedule)} {displayShowSchedule(value)}</h3>
</div> </div>
{/if} {/if}
......
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