Merge branch 'main' into tmp-deployment/proxmox-lxc
This commit is contained in:
+17
@@ -136,6 +136,8 @@
|
|||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>C41 Archive</h1>
|
<h1>C41 Archive</h1>
|
||||||
|
<span class="spacer" style="flex:1"></span>
|
||||||
|
<button id="rescan-btn" title="Rescan the archive folder" style="background:var(--surface);color:var(--text);border:none;padding:6px 10px;border-radius:3px;font-size:14px;cursor:pointer;margin-right:8px">↻</button>
|
||||||
<select id="date"></select>
|
<select id="date"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -707,6 +709,21 @@
|
|||||||
|
|
||||||
dateSelect.addEventListener("change", () => loadDate(dateSelect.value));
|
dateSelect.addEventListener("change", () => loadDate(dateSelect.value));
|
||||||
addEventListener("resize", drawTimeline);
|
addEventListener("resize", drawTimeline);
|
||||||
|
|
||||||
|
// rescan: button + silent auto-poll for new dates
|
||||||
|
const rescanBtn = document.querySelector("#rescan-btn");
|
||||||
|
async function rescan(notify) {
|
||||||
|
try {
|
||||||
|
const r = await fetch("/api/rescan", {method: "POST"});
|
||||||
|
const d = await r.json();
|
||||||
|
if (notify) setStatus(`${d.days} day${d.days !== 1 ? "s" : ""}, ${d.clips} clip${d.clips !== 1 ? "s" : ""} indexed`);
|
||||||
|
loadDate(dateSelect.value || "");
|
||||||
|
return d;
|
||||||
|
} catch { return null; }
|
||||||
|
}
|
||||||
|
rescanBtn.addEventListener("click", () => rescan(true));
|
||||||
|
setInterval(() => { if (!queue.some(e => e.state === "busy")) rescan(false); }, 30000);
|
||||||
|
|
||||||
loadDate("").catch(() => {});
|
loadDate("").catch(() => {});
|
||||||
updateEncodeStatus();
|
updateEncodeStatus();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -111,6 +111,11 @@ class PlayerHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
def do_POST(self):
|
def do_POST(self):
|
||||||
path = urlparse(self.path).path
|
path = urlparse(self.path).path
|
||||||
|
if path == "/api/rescan":
|
||||||
|
self.server.recordings = scan_recordings(self.server.output_root)
|
||||||
|
self.server.system_highlights = scan_system_highlights(self.server.source_root)
|
||||||
|
count = sum(map(len, self.server.recordings.values()))
|
||||||
|
return self.send_json({"ok": True, "days": len(self.server.recordings), "clips": count})
|
||||||
if path == "/api/upload":
|
if path == "/api/upload":
|
||||||
return self.handle_upload()
|
return self.handle_upload()
|
||||||
if path == "/api/encode":
|
if path == "/api/encode":
|
||||||
|
|||||||
Reference in New Issue
Block a user