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
c5f2906f
Commit
c5f2906f
authored
Oct 29, 2020
by
David Trattnig
Browse files
Replaced schedule with timeslot.
engine-api#14
parent
ea70dd52
Changes
4
Show whitespace changes
Inline
Side-by-side
README.md
View file @
c5f2906f
...
@@ -35,8 +35,8 @@ LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"
...
@@ -35,8 +35,8 @@ 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_
TIMESLOT
=
"Right now, there's no show playing"
NO_NEXT_
SCHEDULE
=
"Nothing scheduled next"
NO_NEXT_
TIMESLOT
=
"Nothing scheduled next"
PLAY_OFFSET
=
3
PLAY_OFFSET
=
3
CSS
=
""
CSS
=
""
```
```
...
@@ -54,8 +54,8 @@ able to override any configurations already performed during the build.
...
@@ -54,8 +54,8 @@ able to override any configurations already performed during the build.
api=
"http://localhost:8008/api/v1/"
api=
"http://localhost:8008/api/v1/"
css=
"/css/o94.css"
css=
"/css/o94.css"
unknowntitle=
"Unbekannter Titel"
unknowntitle=
"Unbekannter Titel"
nocurrent
schedule
=
"Derzeit keine Sendung"
nocurrent
timeslot
=
"Derzeit keine Sendung"
nonext
schedule
=
"Keine weiteren Sendungen"
nonext
timeslot
=
"Keine weiteren Sendungen"
playoffset=
3
>
playoffset=
3
>
</aura-clock>
</aura-clock>
```
```
...
...
config/default-sample.env
View file @
c5f2906f
...
@@ -3,8 +3,8 @@ LOGO="https://gitlab.servus.at/aura/meta/-/raw/master/images/aura-logo.png"
...
@@ -3,8 +3,8 @@ 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
="No show playing"
NO_CURRENT_
TIMESLOT
="No show playing"
NO_NEXT_
SCHEDULE
="Nothing scheduled next"
NO_NEXT_
TIMESLOT
="Nothing scheduled next"
PLAY_OFFSET=3
PLAY_OFFSET=3
CSS=""
CSS=""
FALLBACK_TEXT="FALLBACK"
FALLBACK_TEXT="FALLBACK"
\ No newline at end of file
config/o94-sample.env
View file @
c5f2906f
...
@@ -3,8 +3,8 @@ LOGO="https://o94.at/themes/custom/radio_orange/logo1.png"
...
@@ -3,8 +3,8 @@ LOGO="https://o94.at/themes/custom/radio_orange/logo1.png"
LOGO_SIZE=180px
LOGO_SIZE=180px
API_URL="http://localhost:8008/api/v1/"
API_URL="http://localhost:8008/api/v1/"
UNKNOWN_TITLE="Unbekannter Titel"
UNKNOWN_TITLE="Unbekannter Titel"
NO_CURRENT_
SCHEDULE
="Derzeit keine Sendung"
NO_CURRENT_
TIMESLOT
="Derzeit keine Sendung"
NO_NEXT_
SCHEDULE
="Keine weiteren Sendungen"
NO_NEXT_
TIMESLOT
="Keine weiteren Sendungen"
PLAY_OFFSET=3
PLAY_OFFSET=3
CSS="/css/o94.css"
CSS="/css/o94.css"
FALLBACK_TEXT="Notfallprogramm"
FALLBACK_TEXT="Notfallprogramm"
\ No newline at end of file
src/StudioClock.svelte
View file @
c5f2906f
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
export
let
name
=
globalConfig
.
NAME
;
export
let
name
=
globalConfig
.
NAME
;
export
let
logo
=
globalConfig
.
LOGO
;
export
let
logo
=
globalConfig
.
LOGO
;
export
let
logosize
=
globalConfig
.
LOGO_SIZE
;
export
let
logosize
=
globalConfig
.
LOGO_SIZE
;
export
let
nocurrent
schedule
=
globalConfig
.
NO_CURRENT_
SCHEDULE
;
export
let
nocurrent
timeslot
=
globalConfig
.
NO_CURRENT_
TIMESLOT
;
export
let
nonext
schedule
=
globalConfig
.
NO_NEXT_
SCHEDULE
;
export
let
nonext
timeslot
=
globalConfig
.
NO_NEXT_
TIMESLOT
;
export
let
unknowntitle
=
globalConfig
.
UNKNOWN_TITLE
;
export
let
unknowntitle
=
globalConfig
.
UNKNOWN_TITLE
;
export
let
playoffset
=
globalConfig
.
PLAY_OFFSET
;
export
let
playoffset
=
globalConfig
.
PLAY_OFFSET
;
export
let
fallbacktext
=
globalConfig
.
FALLBACK_TEXT
;
export
let
fallbacktext
=
globalConfig
.
FALLBACK_TEXT
;
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
let
clockData
=
null
;
let
clockData
=
null
;
let
currentTrackElement
=
null
;
let
currentTrackElement
=
null
;
let
timeLeft
;
let
timeLeft
;
let
schedule
TimeLeft
=
0
;
let
timeslot
TimeLeft
=
0
;
let
reloadTime
=
10
;
let
reloadTime
=
10
;
let
reloadWait
=
0
;
let
reloadWait
=
0
;
...
@@ -41,12 +41,12 @@
...
@@ -41,12 +41,12 @@
const
interval
=
setInterval
(()
=>
{
const
interval
=
setInterval
(()
=>
{
time
=
new
Date
();
time
=
new
Date
();
timeLeft
-=
1
;
timeLeft
-=
1
;
schedule
TimeLeft
-=
1
;
timeslot
TimeLeft
-=
1
;
/* End of track or end of
schedule
- load new data */
/* End of track or end of
timeslot
- load new data */
if
(
timeLeft
<=
0
||
schedule
TimeLeft
<=
0
)
{
if
(
timeLeft
<=
0
||
timeslot
TimeLeft
<=
0
)
{
/* For some seconds refresh every second, to work around API timing delays */
/* For some seconds refresh every second, to work around API timing delays */
if
(
timeLeft
<=
0
&&
timeLeft
>=
-
3
||
schedule
TimeLeft
<=
0
&&
schedule
TimeLeft
>=
-
3
||
reloadWait
==
0
)
{
if
(
timeLeft
<=
0
&&
timeLeft
>=
-
3
||
timeslot
TimeLeft
<=
0
&&
timeslot
TimeLeft
>=
-
3
||
reloadWait
==
0
)
{
promise
=
fetchApi
(
queryCurrent
);
promise
=
fetchApi
(
queryCurrent
);
reloadWait
=
reloadTime
;
reloadWait
=
reloadTime
;
}
}
...
@@ -112,25 +112,25 @@
...
@@ -112,25 +112,25 @@
timeLeft
=
value
.
current_track
.
track_duration
-
t
-
playoffset
;
timeLeft
=
value
.
current_track
.
track_duration
-
t
-
playoffset
;
}
}
if
(
value
.
current_
schedule
!=
null
)
{
if
(
value
.
current_
timeslot
!=
null
)
{
let
schedule
_end
=
Date
.
parse
(
value
.
current_
schedule
.
schedule
_end
);
let
timeslot
_end
=
Date
.
parse
(
value
.
current_
timeslot
.
timeslot
_end
);
schedule
_end
=
parseInt
(
schedule
_end
/
1000
);
timeslot
_end
=
parseInt
(
timeslot
_end
/
1000
);
schedule
TimeLeft
=
schedule
_end
-
time
;
timeslot
TimeLeft
=
timeslot
_end
-
time
;
}
else
{
}
else
{
/* Decrease time left in any case to avoid reloading too often */
/* Decrease time left in any case to avoid reloading too often */
schedule
TimeLeft
-=
1
;
timeslot
TimeLeft
-=
1
;
}
}
}
}
return
""
;
return
""
;
}
}
/* Checks if there's an existing, valid
schedule
*/
/* Checks if there's an existing, valid
timeslot
*/
function
hasValid
Schedule
(
value
)
{
function
hasValid
Timeslot
(
value
)
{
if
(
value
.
current_
schedule
!=
null
)
{
if
(
value
.
current_
timeslot
!=
null
)
{
if
(
value
.
current_
schedule
.
schedule
_end
!=
null
)
{
if
(
value
.
current_
timeslot
.
timeslot
_end
!=
null
)
{
let
schedule
_end
=
Date
.
parse
(
value
.
current_
schedule
.
schedule
_end
);
let
timeslot
_end
=
Date
.
parse
(
value
.
current_
timeslot
.
timeslot
_end
);
let
diff
=
schedule
_end
-
time
;
let
diff
=
timeslot
_end
-
time
;
if
(
diff
>=
0
)
if
(
diff
>=
0
)
return
true
;
return
true
;
}
}
...
@@ -141,7 +141,7 @@
...
@@ -141,7 +141,7 @@
/* Checks if there is an existing valid playlist */
/* Checks if there is an existing valid playlist */
function
hasValidPlaylist
(
value
)
{
function
hasValidPlaylist
(
value
)
{
if
(
hasValid
Schedule
(
value
))
if
(
hasValid
Timeslot
(
value
))
if
(
value
.
current_playlist
!=
null
)
if
(
value
.
current_playlist
!=
null
)
return
true
;
return
true
;
return
false
;
return
false
;
...
@@ -194,40 +194,40 @@
...
@@ -194,40 +194,40 @@
/* Display the name of a show */
/* Display the name of a show */
function
displayShowName
(
schedule
,
defaultText
)
{
function
displayShowName
(
timeslot
,
defaultText
)
{
let
name
=
""
let
name
=
""
if
(
schedule
==
null
||
schedule
.
show_name
==
null
||
schedule
.
show_name
==
""
)
{
if
(
timeslot
==
null
||
timeslot
.
show_name
==
null
||
timeslot
.
show_name
==
""
)
{
name
=
'
<span class="error">
'
+
defaultText
+
'
</span>
'
;
name
=
'
<span class="error">
'
+
defaultText
+
'
</span>
'
;
}
else
{
}
else
{
name
=
schedule
.
show_name
;
name
=
timeslot
.
show_name
;
}
}
return
name
;
return
name
;
}
}
/* Display the
schedule
of a show */
/* Display the
timeslot
of a show */
function
displayShow
Schedule
(
schedule
)
{
function
displayShow
Timeslot
(
timeslot
)
{
let
str
=
""
;
let
str
=
""
;
if
(
schedule
!=
null
&&
schedule
.
schedule
_start
!=
null
&&
schedule
.
show_name
!=
""
)
{
if
(
timeslot
!=
null
&&
timeslot
.
timeslot
_start
!=
null
&&
timeslot
.
show_name
!=
""
)
{
let
schedule
Start
=
""
let
timeslot
Start
=
""
let
schedule
End
=
""
;
let
timeslot
End
=
""
;
if
(
schedule
.
schedule
_start
!=
null
)
{
if
(
timeslot
.
timeslot
_start
!=
null
)
{
let
schedule
Start
=
new
Date
(
Date
.
parse
(
schedule
.
schedule
_start
));
let
timeslot
Start
=
new
Date
(
Date
.
parse
(
timeslot
.
timeslot
_start
));
scheduleStart
=
schedule
Start
.
toLocaleTimeString
(
navigator
.
language
,
{
timeslotStart
=
timeslot
Start
.
toLocaleTimeString
(
navigator
.
language
,
{
hour
:
'
2-digit
'
,
hour
:
'
2-digit
'
,
minute
:
'
2-digit
'
minute
:
'
2-digit
'
});
});
str
=
schedule
Start
;
str
=
timeslot
Start
;
}
}
if
(
schedule
.
schedule
_end
!=
null
)
{
if
(
timeslot
.
timeslot
_end
!=
null
)
{
schedule
End
=
new
Date
(
Date
.
parse
(
schedule
.
schedule
_end
));
timeslot
End
=
new
Date
(
Date
.
parse
(
timeslot
.
timeslot
_end
));
scheduleEnd
=
schedule
End
.
toLocaleTimeString
(
navigator
.
language
,
{
timeslotEnd
=
timeslot
End
.
toLocaleTimeString
(
navigator
.
language
,
{
hour
:
'
2-digit
'
,
hour
:
'
2-digit
'
,
minute
:
'
2-digit
'
minute
:
'
2-digit
'
});
});
str
=
str
+
"
-
"
+
schedule
End
+
""
;
str
=
str
+
"
-
"
+
timeslot
End
+
""
;
}
else
{
}
else
{
str
+=
""
;
str
+=
""
;
}
}
...
@@ -239,9 +239,9 @@
...
@@ -239,9 +239,9 @@
/* Indicates if some fallback is playing */
/* Indicates if some fallback is playing */
function
isFallback
(
value
)
{
function
isFallback
(
value
)
{
if
(
"
current_
schedule
"
in
value
)
if
(
"
current_
timeslot
"
in
value
)
return
true
;
return
true
;
if
(
current_
schedule
.
fallback_type
>
0
)
if
(
current_
timeslot
.
fallback_type
>
0
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
@@ -327,32 +327,32 @@
...
@@ -327,32 +327,32 @@
filter
:
invert
(
100%
);
filter
:
invert
(
100%
);
}
}
#current-
schedule
{
#current-
timeslot
{
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
:
700px
;
height
:
700px
;
}
}
#current-
schedule
,
#current-
timeslot
,
#next-
schedule
{
#next-
timeslot
{
margin
:
0
0
40px
20px
;
margin
:
0
0
40px
20px
;
}
}
#next-
schedule
{
#next-
timeslot
{
background-color
:
rgb
(
24
,
24
,
24
);
background-color
:
rgb
(
24
,
24
,
24
);
margin-right
:
20px
;
margin-right
:
20px
;
padding
:
12px
;
padding
:
12px
;
text-align
:
center
;
text-align
:
center
;
}
}
#current-
schedule
.schedule
-title
{
#current-
timeslot
.timeslot
-title
{
text-align
:
center
;
text-align
:
center
;
height
:
100px
;
height
:
100px
;
overflow
:
revert
;
overflow
:
revert
;
}
}
#current-
schedule
.schedule
-title
h1
{
#current-
timeslot
.timeslot
-title
h1
{
color
:
#ccc
;
color
:
#ccc
;
font-size
:
2.8em
;
font-size
:
2.8em
;
position
:
relative
;
position
:
relative
;
...
@@ -360,7 +360,7 @@
...
@@ -360,7 +360,7 @@
transform
:
translateY
(
-50%
);
transform
:
translateY
(
-50%
);
}
}
#next-
schedule
.schedule
-title
{
#next-
timeslot
.timeslot
-title
{
color
:
gray
!important
;
color
:
gray
!important
;
font-size
:
2em
;
font-size
:
2em
;
}
}
...
@@ -585,13 +585,13 @@
...
@@ -585,13 +585,13 @@
{initComponent(value)}
{initComponent(value)}
<div
id=
"current-
schedule
"
>
<div
id=
"current-
timeslot
"
>
<div
class=
"
schedule
-title"
>
<div
class=
"
timeslot
-title"
>
<h1>
<h1>
{#if hasValid
Schedule
(value)}
{#if hasValid
Timeslot
(value)}
{@html displayShowName(value.current_
schedule
, nocurrent
schedule
)} {displayShow
Schedule
(value.current_
schedule
)}
{@html displayShowName(value.current_
timeslot
, nocurrent
timeslot
)} {displayShow
Timeslot
(value.current_
timeslot
)}
{:else}
{:else}
<span
class=
"error"
>
{nocurrent
schedule
}
</span>
<span
class=
"error"
>
{nocurrent
timeslot
}
</span>
{/if}
{/if}
{#if isFallback(value)}
{#if isFallback(value)}
<span
class=
"fallback-indicator"
>
{fallbacktext}
</span>
<span
class=
"fallback-indicator"
>
{fallbacktext}
</span>
...
@@ -643,9 +643,9 @@
...
@@ -643,9 +643,9 @@
{#if value.current_
schedule
}
{#if value.current_
timeslot
}
<div
id=
"next-
schedule
"
>
<div
id=
"next-
timeslot
"
>
<h3
class=
"
schedule
-title"
>
{@html displayShowName(value.next_
schedule, nonextschedule
)} {displayShow
Schedule
(value)}
</h3>
<h3
class=
"
timeslot
-title"
>
{@html displayShowName(value.next_
timeslot, nonexttimeslot
)} {displayShow
Timeslot
(value)}
</h3>
</div>
</div>
{/if}
{/if}
{:catch error}
{: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