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 19:50:31 -07:00
|
|
|
for (let activity of ["reader", "encoder"]) {
|
2022-01-06 17:33:25 -07:00
|
|
|
let val = s.status[activity]
|
|
|
|
let e = document.querySelector(`.status .${activity}`)
|
2022-01-09 19:50:31 -07:00
|
|
|
e.textContent = val
|
2022-01-06 17:33:25 -07:00
|
|
|
if (val == "idle") {
|
2022-01-09 19:50:31 -07:00
|
|
|
e.classList.add("is-hidden")
|
2022-01-06 17:33:25 -07:00
|
|
|
} else {
|
2022-01-09 19:50:31 -07:00
|
|
|
e.classList.remove("is-hidden")
|
2022-01-06 17:33:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-09 19:50:31 -07:00
|
|
|
let qtmpl = document.querySelector("template.job-item").content
|
|
|
|
let qelem = document.querySelector(".jobs")
|
2022-01-09 17:14:59 -07:00
|
|
|
while (qelem.firstChild) qelem.firstChild.remove()
|
|
|
|
for (let qitem of s.queue) {
|
|
|
|
let e = qtmpl.cloneNode(true)
|
2022-01-09 19:50:31 -07:00
|
|
|
e.querySelector(".job-title").textContent = qitem.title
|
|
|
|
e.querySelector(".job-status").textContent = qitem.status
|
2022-01-09 17:14:59 -07:00
|
|
|
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
|