2022-01-06 17:33:25 -07:00
|
|
|
const MILLISECOND = 1
|
|
|
|
const SECOND = 1000
|
|
|
|
|
|
|
|
async function update() {
|
|
|
|
let resp = await fetch("status.json", {cache: "no-store"})
|
|
|
|
let s = await resp.json()
|
|
|
|
|
2022-01-09 17:14:59 -07:00
|
|
|
for (let activity of ["reader"]) {
|
2022-01-06 17:33:25 -07:00
|
|
|
let val = s.status[activity]
|
|
|
|
let e = document.querySelector(`.status .${activity}`)
|
|
|
|
let txt = e.querySelector(".text")
|
|
|
|
let progress = e.querySelector("progress")
|
|
|
|
txt.textContent = val
|
|
|
|
if (val == "idle") {
|
|
|
|
progress.value = 0
|
|
|
|
} else {
|
|
|
|
// Removing the value makes it pulse
|
|
|
|
progress.removeAttribute("value")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-09 17:14:59 -07:00
|
|
|
let qtmpl = document.querySelector("template.encoder-item").content
|
|
|
|
let qelem = document.querySelector(".encoder")
|
|
|
|
while (qelem.firstChild) qelem.firstChild.remove()
|
|
|
|
for (let qitem of s.queue) {
|
|
|
|
let e = qtmpl.cloneNode(true)
|
|
|
|
e.querySelector(".encoder-title").textContent = qitem.title
|
|
|
|
e.querySelector("progress").value = qitem.complete
|
|
|
|
qelem.append(e)
|
|
|
|
}
|
|
|
|
|
2022-01-06 17:33:25 -07:00
|
|
|
let fileItem = document.querySelector("template.panel-file-item").content
|
|
|
|
|
|
|
|
for (let section of ["video", "audio"]) {
|
|
|
|
let e = document.querySelector(`.${section} .items`)
|
|
|
|
while (e.firstChild) e.firstChild.remove()
|
|
|
|
for (let fn of s.finished[section]) {
|
|
|
|
let item = fileItem.cloneNode(true)
|
|
|
|
item.querySelector(".filename").textContent = fn
|
|
|
|
e.append(item)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setInterval(update, 2 * SECOND)
|
|
|
|
update()
|
|
|
|
|
|
|
|
// vi: ts=2 sw=2 et ai
|