demo UI has "now" support
This commit is contained in:
parent
5bfe52c235
commit
a3dcb0795a
2 changed files with 20 additions and 5 deletions
10
index.html
10
index.html
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
#show-info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
.info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -11,11 +11,11 @@
|
||||||
<script src="dist/radiomanifest-oldstyle.bundle.js"></script>
|
<script src="dist/radiomanifest-oldstyle.bundle.js"></script>
|
||||||
<script src="ui.js"></script>
|
<script src="ui.js"></script>
|
||||||
<div id="player">
|
<div id="player">
|
||||||
<audio controls>
|
<audio controls>
|
||||||
</audio>
|
</audio>
|
||||||
|
<div class="info" id="now-info"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="show-info">
|
<div class="info" id="show-info"> </div>
|
||||||
</div>
|
|
||||||
<div id="shows">
|
<div id="shows">
|
||||||
<ul>
|
<ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
15
ui.js
15
ui.js
|
@ -1,4 +1,15 @@
|
||||||
// const radiomanifest = require('radiomanifest.js')
|
// const radiomanifest = require('radiomanifest.js')
|
||||||
|
|
||||||
|
function updateNow(radio) {
|
||||||
|
var box = document.querySelector('#now-info')
|
||||||
|
const show = radio.getSchedule().getNowShow()
|
||||||
|
try {
|
||||||
|
var text = show.getName()
|
||||||
|
} catch (e) {
|
||||||
|
var text = String(show)
|
||||||
|
}
|
||||||
|
box.textContent = text
|
||||||
|
}
|
||||||
async function fai () {
|
async function fai () {
|
||||||
const radio = await radiomanifest.get('https://radiomanifest.degenerazione.xyz/v0.2/examples/full-ondarossa')
|
const radio = await radiomanifest.get('https://radiomanifest.degenerazione.xyz/v0.2/examples/full-ondarossa')
|
||||||
console.log('radio?', radio)
|
console.log('radio?', radio)
|
||||||
|
@ -34,6 +45,10 @@ async function fai () {
|
||||||
const info = document.querySelector('#show-info')
|
const info = document.querySelector('#show-info')
|
||||||
info.textContent = radio.getShowByName(evt.target.dataset['show']).getFeed()
|
info.textContent = radio.getShowByName(evt.target.dataset['show']).getFeed()
|
||||||
}, true)
|
}, true)
|
||||||
|
|
||||||
|
updateNow(radio)
|
||||||
|
console.log(radio.getSchedule())
|
||||||
|
setInterval(function() { updateNow(radio) }, 2000)
|
||||||
}
|
}
|
||||||
|
|
||||||
fai()
|
fai()
|
||||||
|
|
Loading…
Reference in a new issue