Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard-clock
Commits
6b96fa2c
Commit
6b96fa2c
authored
Oct 25, 2020
by
david
Browse files
Updates for fallbacks.
engine#43
engine#44
parent
fd2ee29c
Changes
2
Show whitespace changes
Inline
Side-by-side
config/default-sample.env
View file @
6b96fa2c
...
...
@@ -3,7 +3,7 @@ LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"
LOGO_SIZE="100px"
API_URL="http://localhost:8008/api/v1/"
UNKNOWN_TITLE="Unknown Title"
NO_CURRENT_SCHEDULE="
Right now, there's n
o show playing"
NO_CURRENT_SCHEDULE="
N
o show playing"
NO_NEXT_SCHEDULE="Nothing scheduled next"
PLAY_OFFSET=3
CSS=""
...
...
src/StudioClock.svelte
View file @
6b96fa2c
...
...
@@ -24,7 +24,7 @@
let
currentTrackElement
=
null
;
let
timeLeft
;
let
scheduleTimeLeft
=
0
;
let
reloadTime
=
10
;
let
reloadTime
=
10
0
;
let
reloadWait
=
0
;
// these automatically update when `time`
...
...
@@ -106,7 +106,7 @@
clockData
=
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
);
t
=
parseInt
(
t
/
1000
);
timeLeft
=
value
.
current_track
.
track_duration
-
t
-
playoffset
;
...
...
@@ -194,10 +194,10 @@
/* Display the name of a show */
function
displayShowName
(
schedule
)
{
function
displayShowName
(
schedule
,
defaultText
)
{
let
name
=
""
if
(
schedule
==
null
||
schedule
.
show_name
==
null
)
{
name
=
'
<span class="error">
'
+
nonextschedule
+
'
</span>
'
;
if
(
schedule
==
null
||
schedule
.
show_name
==
null
||
schedule
.
show_name
==
""
)
{
name
=
'
<span class="error">
'
+
defaultText
+
'
</span>
'
;
}
else
{
name
=
schedule
.
show_name
;
}
...
...
@@ -209,7 +209,7 @@
function
displayShowSchedule
(
schedule
)
{
let
str
=
""
;
if
(
schedule
!=
null
&&
schedule
.
schedule_start
!=
null
)
{
if
(
schedule
!=
null
&&
schedule
.
schedule_start
!=
null
&&
schedule
.
show_name
!=
""
)
{
let
scheduleStart
=
""
let
scheduleEnd
=
""
;
...
...
@@ -219,7 +219,7 @@
hour
:
'
2-digit
'
,
minute
:
'
2-digit
'
});
str
=
"
—
"
+
scheduleStart
;
str
=
scheduleStart
;
}
if
(
schedule
.
schedule_end
!=
null
)
{
scheduleEnd
=
new
Date
(
Date
.
parse
(
schedule
.
schedule_end
));
...
...
@@ -238,7 +238,9 @@
/* 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
)
return
true
;
return
false
;
...
...
@@ -247,7 +249,7 @@
/* Check if the given track is currently playing */
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
false
;
...
...
@@ -280,7 +282,7 @@
#studio-clock
{
width
:
calc
(
100%
-
200px
);
height
:
calc
(
10
0%
-
5
00px
);
height
:
calc
(
7
0%
-
3
00px
);
margin
:
0
50px
50px
50px
;
display
:
-webkit-flex
;
display
:
-ms-flexbox
;
...
...
@@ -329,7 +331,7 @@
border
:
2px
solid
#333
;
margin
:
20px
20px
40px
20px
;
background-color
:
#111
;
height
:
1
00
%
;
height
:
7
00
px
;
}
#current-schedule
,
...
...
@@ -347,6 +349,7 @@
#current-schedule
.schedule-title
{
text-align
:
center
;
height
:
100px
;
overflow
:
revert
;
}
#current-schedule
.schedule-title
h1
{
...
...
@@ -369,7 +372,7 @@
padding
:
10px
;
display
:
flex
;
align-items
:
center
;
border-top
:
1px
solid
#333
;
;
border-top
:
1px
solid
#333
;
}
#playlist
::-webkit-scrollbar-track
...
...
@@ -586,13 +589,13 @@
<div
class=
"schedule-title"
>
<h1>
{#if hasValidSchedule(value)}
{@html displayShowName(value.current_schedule)} {displayShowSchedule(value.current_schedule)}
{#if isFallback(value.current_schedule)}
<span
class=
"fallback-indicator"
>
{fallbacktext}
</span>
{/if}
{@html displayShowName(value.current_schedule, nocurrentschedule)} {displayShowSchedule(value.current_schedule)}
{:else}
<span
class=
"error"
>
{nocurrentschedule}
</span>
{/if}
{#if isFallback(value)}
<span
class=
"fallback-indicator"
>
{fallbacktext}
</span>
{/if}
</h1>
</div>
<div
id=
"playlist"
>
...
...
@@ -614,7 +617,9 @@
<li
class=
"playlist-entry"
>
<span
class=
"track-title"
>
{displayTitle(entry)}
</span>
<span
class=
"track-type"
>
{displayType(entry)}
</span>
{#if entry.track_duration > 0 }
<span
class=
"track-duration"
>
{formatTime(entry.track_duration)}
</span>
{/if}
</li>
{/if}
...
...
@@ -640,7 +645,7 @@
{#if value.current_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>
{/if}
{:catch error}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment