Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
430d909396 | ||
|
|
d802b06c88 | ||
|
|
4ee270c37b |
@@ -60,6 +60,7 @@ Base URL `http://127.0.0.1:18765`.
|
||||
| Method | Path | Params |
|
||||
|---|---|---|
|
||||
| GET | `/status` | all recordings + pipeline status |
|
||||
| GET | `/health` | `ok` when the server is up (the extension checks it before recording) |
|
||||
| GET | `/report` | `name` → report HTML |
|
||||
| GET | `/pdf` | `name` → report PDF |
|
||||
| GET | `/search` | `q` → full-text search over transcripts/topics |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Teams Whisper Recorder",
|
||||
"version": "1.1",
|
||||
"version": "1.2",
|
||||
"description": "Record Teams tab audio+video (+mic) and transcribe with local whisper server",
|
||||
"permissions": ["tabCapture", "offscreen", "activeTab", "tabs", "declarativeNetRequest"],
|
||||
"host_permissions": ["http://127.0.0.1:18765/*", "https://teams.cloud.microsoft/*", "https://teams.microsoft.com/*"],
|
||||
|
||||
@@ -7,6 +7,18 @@
|
||||
body[data-state=transcribing] { --accent: #2563eb; }
|
||||
body[data-state=done] { --accent: #16a34a; }
|
||||
body[data-state=error] { --accent: #d97706; }
|
||||
body[data-state=offline] { --accent: #dc2626; }
|
||||
#off { margin-bottom: 12px; padding: 12px 14px; border-radius: 8px; background: #fef2f2; border: 2px solid #dc2626; color: #7f1d1d; }
|
||||
#off b { display: block; margin-bottom: 4px; font-size: 15px; color: #b91c1c; }
|
||||
#off ol { margin: 8px 0 0; padding-left: 20px; }
|
||||
body[data-state=offline] #st, body[data-state=offline] #txt { display: none; }
|
||||
body[data-state=offline] #go:disabled { opacity: 1; background: #fecaca; color: #991b1b; }
|
||||
/* Offline alarm: banner, button and dot strobe red/white. 0.4 s per cycle = 2.5 flashes/s, under the 3/s photosensitivity limit.
|
||||
No prefers-reduced-motion opt-out on purpose: Windows with animations off reports "reduce" and would hide the alarm. */
|
||||
body[data-state=offline] #off { animation: strobe .4s steps(1) infinite; }
|
||||
body[data-state=offline] #go:disabled, body[data-state=offline] .dot { animation: strobe .4s steps(1) infinite reverse; }
|
||||
@keyframes strobe { 0% { background: #dc2626; color: #fff; border-color: #fff; } 50% { background: #fff; color: #b91c1c; border-color: #dc2626; } }
|
||||
body[data-state=offline] #off b { color: inherit; }
|
||||
h1 { margin: 0 0 12px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
|
||||
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
|
||||
body[data-state=recording] .dot { animation: pulse 1.2s infinite; }
|
||||
@@ -18,14 +30,27 @@
|
||||
#st { margin-top: 12px; padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0; border-left: 3px solid var(--accent); border-radius: 6px; word-break: break-word; }
|
||||
#txt { margin: 12px 0 0; padding: 10px; white-space: pre-wrap; max-height: 260px; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; font: 12px/1.45 ui-monospace, Consolas, monospace; }
|
||||
#txt:empty { display: none; }
|
||||
#srv { margin-top: 8px; font-size: 12px; color: #475569; display: flex; align-items: center; gap: 6px; }
|
||||
#srv::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
|
||||
#srv[data-ok=true]::before { background: #16a34a; }
|
||||
#srv[data-ok=false] { color: #dc2626; font-weight: 600; }
|
||||
#srv[data-ok=false]::before { background: #dc2626; }
|
||||
a { display: inline-block; margin-top: 12px; color: #475569; font-size: 12px; }
|
||||
</style>
|
||||
<body data-state="idle">
|
||||
<h1><span class="dot"></span>Teams Whisper</h1>
|
||||
<!-- Shown by popup.js when /health fails and nothing is recording. -->
|
||||
<div id="off" hidden>
|
||||
<b>Backend offline. Recording is NOT possible.</b>
|
||||
The Teams Whisper server (127.0.0.1:18765) is not running, so nothing would be saved.
|
||||
<ol><li>Open Pinokio, then Teams Whisper, then press <b style="display:inline;font-size:inherit">Start</b>.</li><li>Wait until the dot below turns green.</li><li>Press Start here again.</li></ol>
|
||||
</div>
|
||||
<!-- Start/Stop; popup.js drives it. -->
|
||||
<button id="go">Start</button>
|
||||
<!-- Status line, filled by popup.js. -->
|
||||
<div id="st"></div>
|
||||
<!-- Backend health (/health), refreshed every second by popup.js. -->
|
||||
<div id="srv"></div>
|
||||
<!-- Transcript/result text returned by the recorder. -->
|
||||
<pre id="txt"></pre>
|
||||
<!-- mic.html opens in a new tab so the permission prompt can appear; needed once. -->
|
||||
|
||||
+17
-6
@@ -6,16 +6,24 @@ const sendToOffscreen = message => chrome.runtime.sendMessage({ to: "off", ...me
|
||||
// Format milliseconds as m:ss.
|
||||
const formatElapsed = milliseconds => { const totalSeconds = Math.floor(milliseconds / 1000); return `${Math.floor(totalSeconds / 60)}:${String(totalSeconds % 60).padStart(2, "0")}`; };
|
||||
// Last error shown when there is no offscreen document to report it.
|
||||
let recorderState = { state: "idle" }, lastError = "";
|
||||
let recorderState = { state: "idle" }, lastError = "", serverOk = null;
|
||||
// Backend liveness (server.py /health); false on any error or after 1.5 s.
|
||||
const serverUp = () => fetch("http://127.0.0.1:18765/health", { signal: AbortSignal.timeout(1500) }).then(response => response.ok, () => false);
|
||||
|
||||
// Refresh the button and status line from state recorderState.
|
||||
function render() {
|
||||
const goButton = byId("go"), statusLine = byId("st");
|
||||
document.body.dataset.state = recorderState.state;
|
||||
// Backend down and not mid-recording: starting is impossible, the offline banner replaces the status line.
|
||||
const offline = serverOk === false && recorderState.state !== "recording";
|
||||
document.body.dataset.state = offline ? "offline" : recorderState.state;
|
||||
byId("off").hidden = !offline;
|
||||
// Pipeline busy after stop: no new start until it finishes.
|
||||
goButton.disabled = recorderState.state === "transcribing";
|
||||
goButton.disabled = offline || recorderState.state === "transcribing";
|
||||
// Backend indicator under the button.
|
||||
byId("srv").dataset.ok = serverOk ?? "";
|
||||
byId("srv").textContent = serverOk == null ? "server: checking..." : serverOk ? "server: online" : "server: OFFLINE";
|
||||
// Button doubles as Stop while recording.
|
||||
goButton.textContent = recorderState.state === "recording" ? "Stop + transcribe" : "Start";
|
||||
goButton.textContent = offline ? "Recording blocked: server offline" : recorderState.state === "recording" ? "Stop + transcribe" : "Start";
|
||||
// Status line text per recorder state.
|
||||
statusLine.textContent = {
|
||||
idle: "idle - open a Teams tab and press Start",
|
||||
@@ -30,8 +38,9 @@ function render() {
|
||||
|
||||
// Poll the recorder state every second.
|
||||
async function poll() {
|
||||
// Offscreen doc exists: ask it for its state. Otherwise show the last error, or idle.
|
||||
if (await chrome.offscreen.hasDocument()) recorderState = (await sendToOffscreen({ cmd: "status" })) || recorderState; else recorderState = lastError ? { state: "error", text: lastError } : { state: "idle" };
|
||||
// A failed Start wins; else ask the offscreen doc (if any) for its state, or show idle.
|
||||
recorderState = lastError ? { state: "error", text: lastError } : (await chrome.offscreen.hasDocument()) ? (await sendToOffscreen({ cmd: "status" })) || recorderState : { state: "idle" };
|
||||
serverOk = await serverUp();
|
||||
render();
|
||||
}
|
||||
|
||||
@@ -54,6 +63,8 @@ byId("go").onclick = async () => {
|
||||
if (activeTab.url?.startsWith("chrome-extension:")) throw new Error("This is the extension's own page. Switch to the Teams tab, then click the icon.");
|
||||
// Stream id that the offscreen document later passes to getUserMedia.
|
||||
const streamId = await chrome.tabCapture.getMediaStreamId({ targetTabId: activeTab.id });
|
||||
// Health check before recording: backend down = nothing would be saved, so show the offline banner and stop here.
|
||||
if (!(serverOk = await serverUp())) return render();
|
||||
// Create the offscreen document once; it stays alive while recording.
|
||||
if (!(await chrome.offscreen.hasDocument()))
|
||||
await chrome.offscreen.createDocument({ url: "offscreen.html", reasons: ["USER_MEDIA"], justification: "record tab" });
|
||||
|
||||
+24
-73
@@ -60,11 +60,6 @@ def mmss(seconds):
|
||||
return f"{seconds // 60:02d}:{seconds % 60:02d}"
|
||||
|
||||
|
||||
# Talk time cell: "—" when silent, "<1 min" under a minute.
|
||||
def _mins(seconds):
|
||||
return "—" if not seconds else f"{int(seconds // 60)} min" if seconds >= 60 else "<1 min"
|
||||
|
||||
|
||||
# "mm:ss" (or leading digits) -> seconds; 0 if no match.
|
||||
def secs(text):
|
||||
match = re.match(r"(\d+):(\d+)", str(text))
|
||||
@@ -862,9 +857,8 @@ def render(name):
|
||||
docs = _load(name, "docs.json", None)
|
||||
items = {item["i"]: item for item in (docs or {}).get("items", [])}
|
||||
report_data, names = named(name, report_data)
|
||||
# Speaker-labelled paragraphs (caption-split) and diarized speech spans, for talk time.
|
||||
paragraphs = _transcript(name)
|
||||
speech = sorted((segment["start"], segment["end"]) for segment in _load(name, "diar_segments.json", []))
|
||||
# Participant names only (named speakers + attendees); rendered as small cards at the end.
|
||||
people = sorted({*names.values(), *(att["who"] for att in report_data["attendees"])})
|
||||
|
||||
# Turn ticket keys into Jira links.
|
||||
def link(raw):
|
||||
@@ -883,70 +877,6 @@ def render(name):
|
||||
"",
|
||||
]
|
||||
lines += [f"- {item}" for item in report_data["tldr"]] + [""]
|
||||
|
||||
# participants
|
||||
# Talk time per named speaker: speech detected inside each paragraph's window (silence and pauses excluded).
|
||||
talk = {}
|
||||
for index, (stamp, label, _) in enumerate(paragraphs):
|
||||
person = names.get(label)
|
||||
if person:
|
||||
end = paragraphs[index + 1][0] if index + 1 < len(paragraphs) else stamp + 30
|
||||
talk[person] = talk.get(person, 0) + sum(
|
||||
max(0, min(end, speech_end) - max(stamp, speech_start)) for speech_start, speech_end in speech
|
||||
)
|
||||
# Video-sourced attendance: names read from frames only, no presence times.
|
||||
video = report_data["attendees_source"] == "video"
|
||||
if video:
|
||||
people = sorted({attendee["who"] for attendee in report_data["attendees"]})
|
||||
if talk or people:
|
||||
lines += ["## Partecipanti", ""]
|
||||
if talk:
|
||||
lines += (
|
||||
["| Partecipante | Parlato |", "|---|---|"]
|
||||
+ [f"| {person} | {_mins(seconds)} |" for person, seconds in talk.items()]
|
||||
+ [""]
|
||||
)
|
||||
if people:
|
||||
lines += [
|
||||
"*Nomi letti dai fotogrammi (ortografia verificata sulla documentazione): verificare.*"
|
||||
if report_data.get("known_spelling")
|
||||
else "*Nomi letti dai fotogrammi: verificare.*",
|
||||
"",
|
||||
", ".join(people),
|
||||
"",
|
||||
]
|
||||
else:
|
||||
rows = {person: [seconds, None] for person, seconds in talk.items()}
|
||||
# Teams-sourced: join talk time with presence windows by name (case-insensitive).
|
||||
for attendee in report_data["attendees"]:
|
||||
row_name = next(
|
||||
(person for person in rows if person.lower() == attendee["who"].lower()),
|
||||
attendee["who"],
|
||||
)
|
||||
rows.setdefault(row_name, [0, None])[1] = (
|
||||
f"{mmss(attendee['first_t'])}–{mmss(attendee['last_t'])}"
|
||||
)
|
||||
if rows:
|
||||
lines += [
|
||||
"## Partecipanti",
|
||||
"",
|
||||
"| Partecipante | Parlato | Presente |",
|
||||
"|---|---|---|",
|
||||
]
|
||||
lines += [
|
||||
f"| {person} | {_mins(pair[0])} | {pair[1] or '—'} |"
|
||||
for person, pair in rows.items()
|
||||
] + [""]
|
||||
# Screen-share spans.
|
||||
if report_data["shares"]:
|
||||
lines += (
|
||||
["## Condivisioni schermo", ""]
|
||||
+ [
|
||||
f"- {mmss(share['start'])}–{mmss(share['end'])} {share['who']}"
|
||||
for share in report_data["shares"]
|
||||
]
|
||||
+ [""]
|
||||
)
|
||||
heads = []
|
||||
# Topic index with anchor links to the sections below.
|
||||
lines += ["## Argomenti", ""]
|
||||
@@ -1093,6 +1023,24 @@ def render(name):
|
||||
for frame in report_data["screen"]
|
||||
]
|
||||
lines += ["", "</details>", ""]
|
||||
# Screen-share spans.
|
||||
if report_data["shares"]:
|
||||
lines += (
|
||||
["## Condivisioni schermo", ""]
|
||||
+ [
|
||||
f"- {mmss(share['start'])}–{mmss(share['end'])} {share['who']}"
|
||||
for share in report_data["shares"]
|
||||
]
|
||||
+ [""]
|
||||
)
|
||||
# Participants last: tiny chips, hidden in the PDF (print CSS in server.py).
|
||||
if people:
|
||||
lines += [
|
||||
"## Partecipanti",
|
||||
"",
|
||||
'<p class="ppl">' + "".join(f"<span>{person}</span>" for person in people) + "</p>",
|
||||
"",
|
||||
]
|
||||
text = "\n".join(lines)
|
||||
(folder / "report.md").write_text(text, encoding="utf-8")
|
||||
# Markdown -> HTML (tables, toc, raw HTML blocks).
|
||||
@@ -1125,7 +1073,10 @@ td,th{padding:9px 14px;border-bottom:1px solid var(--line);text-align:left;verti
|
||||
img{width:100%;border:1px solid var(--line);border-radius:12px;margin-top:.8em;cursor:zoom-in}p>em{color:var(--mut);font-size:.88em}
|
||||
img.zoom{position:fixed;inset:0;width:100vw;height:100vh;margin:0;object-fit:contain;background:#000d;border:0;border-radius:0;cursor:zoom-out;z-index:9}
|
||||
details{margin-top:2.4em;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 18px}summary{cursor:pointer;color:var(--acc);font-weight:500}
|
||||
code{background:var(--soft);border-radius:5px;padding:.1em .35em;font-size:.9em}"""
|
||||
code{background:var(--soft);border-radius:5px;padding:.1em .35em;font-size:.9em}
|
||||
h2#partecipanti{font-size:.7em;font-weight:600;text-transform:uppercase;letter-spacing:.08em;color:var(--mut);opacity:.5;border-top:0;margin:4em 0 .5em;padding-top:0;font-family:inherit}
|
||||
.ppl{margin:0;opacity:.5;line-height:2}
|
||||
.ppl span{display:inline-block;background:var(--soft);border:1px solid var(--line);border-radius:999px;padding:1px 9px;margin:0 5px 4px 0;font-size:.72em;color:var(--mut)}"""
|
||||
# Write a single self-contained HTML document (CSS inline, images base64).
|
||||
(folder / "report.html").write_text(
|
||||
f'<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{title_text}</title><style>{style}</style>\n{body}<script>document.querySelectorAll("img").forEach(img=>img.onclick=()=>img.classList.toggle("zoom"))</script>',
|
||||
|
||||
+4
-2
@@ -126,14 +126,16 @@ def review(name):
|
||||
if english(text):
|
||||
fail("R5", text)
|
||||
|
||||
# R6: read the participants section (table rows or comma list).
|
||||
section = re.search(r"## Partecipanti\n(.*?)(?=\n## )", markdown_text, re.S)
|
||||
# R6: read the participants section (table rows, chips or comma list); it is the last section.
|
||||
section = re.search(r"## Partecipanti\n(.*?)(?=\n## |\Z)", markdown_text, re.S)
|
||||
people = []
|
||||
for line in section[1].splitlines() if section else []:
|
||||
if line.startswith("|"):
|
||||
cell = line.split("|")[1].strip()
|
||||
if cell not in ("Partecipante", "") and not cell.startswith("-"):
|
||||
people.append(cell)
|
||||
elif "<span>" in line:
|
||||
people += re.findall(r"<span>(.*?)</span>", line)
|
||||
elif line.strip() and not line.startswith("*"):
|
||||
people += [name_part.strip() for name_part in line.split(",")]
|
||||
# R6: no initials or truncated names.
|
||||
|
||||
@@ -63,6 +63,7 @@ PRINT_CSS = (
|
||||
"#in-breve+ul{border-radius:0;padding:10px 16px 10px 2em}"
|
||||
"details{border:0;padding:0;margin-top:1em;background:none}summary{display:none}"
|
||||
"img{border-radius:0;max-width:100%}code{border-radius:0}"
|
||||
"#partecipanti,.ppl{display:none}"
|
||||
"img,tr{break-inside:avoid}h2,h3{break-after:avoid}}"
|
||||
)
|
||||
# Serializes ask_once: one llama start/stop at a time.
|
||||
@@ -858,6 +859,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
)
|
||||
elif parsed.path == "/status":
|
||||
self._json(status())
|
||||
# Cheap liveness probe for the extension (checked before recording starts).
|
||||
elif parsed.path == "/health":
|
||||
self._send(b"ok")
|
||||
elif parsed.path == "/report":
|
||||
file_path = out_root / name / "report.html"
|
||||
self._send(
|
||||
|
||||
+13
-7
@@ -65,7 +65,7 @@ const pgo=new Set();
|
||||
function togPg(name){pgo.has(name)?pgo.delete(name):pgo.add(name);tick()}
|
||||
// Speakers panel: diarization label -> person mapping, with a datalist of candidate names.
|
||||
async function panel(name){const data=await (await fetch("/speakers?name="+name)).json();
|
||||
return `<tr class=sp><td colspan=6><datalist id="cand-${name}">${data.candidates.map(candidate=>`<option value="${E(candidate)}">`).join("")}</datalist>`+
|
||||
return `<tr class=sp><td colspan=7><datalist id="cand-${name}">${data.candidates.map(candidate=>`<option value="${E(candidate)}">`).join("")}</datalist>`+
|
||||
data.rows.map(row=>`<div><b>${E(row.label)}</b> ${fmt(row.talk_s)} <input data-n="${name}" data-l="${E(row.label)}" list="cand-${name}" value="${E(row.person)}"> ${row.source}${row.source==="auto"&&row.overlap_s!=null?" "+Math.round(row.overlap_s)+"s":""}<br><small>${row.samples.map(E).join(" | ")}</small></div>`).join("")+
|
||||
`<div class=sa><button class=pri onclick="saveSpk('${name}')">✓ Salva nomi</button><button onclick="spk('${name}')">✕ Chiudi</button></div>`}
|
||||
// Read the label -> person inputs and save them (/speaker_map).
|
||||
@@ -156,9 +156,9 @@ return `<div class="live ${cls}"><span class=dot></span><span>${txt?txt+" — ":
|
||||
// Progress panel for a recording: boot, queued, or running pipeline.
|
||||
function progPanel(row){const prog=row.prog,stop=`<span class=acts>${row.flow_run_id?`<a class=btn href="http://127.0.0.1:4200/runs/flow-run/${row.flow_run_id}" target=_blank>prefect</a>`:""}<button class=del onclick="stopRun('${row.name}')">■ stop</button></span>`;
|
||||
// Pipeline starting: the Python environment can take minutes on the first run.
|
||||
if(!prog&&row.running)return `<tr><td colspan=6><div class=pg><div class=pgh><span><span class=big>…</span> <b>Avvio della pipeline</b> <span class=n>— preparazione dell'ambiente Python (la prima volta scarica le dipendenze: qualche minuto)</span></span>${stop}</div><div class="bar ind"><i></i></div><div class="live"><span class=dot></span><span>${E(row.boot||"in avvio…")}</span></div></div>`;
|
||||
if(!prog&&row.running)return `<tr><td colspan=7><div class=pg><div class=pgh><span><span class=big>…</span> <b>Avvio della pipeline</b> <span class=n>— preparazione dell'ambiente Python (la prima volta scarica le dipendenze: qualche minuto)</span></span>${stop}</div><div class="bar ind"><i></i></div><div class="live"><span class=dot></span><span>${E(row.boot||"in avvio…")}</span></div></div>`;
|
||||
// Queued behind another run, or nothing to show.
|
||||
if(!prog)return row.status==="queued"?`<tr><td colspan=6><div class=pg><div class=pgh><b>In coda</b><span><span class=eta>parte appena finisce l'elaborazione in corso</span> ${stop}</span></div><div class="bar ind"><i></i></div></div>`:"";
|
||||
if(!prog)return row.status==="queued"?`<tr><td colspan=7><div class=pg><div class=pgh><b>In coda</b><span><span class=eta>parte appena finisce l'elaborazione in corso</span> ${stop}</span></div><div class="bar ind"><i></i></div></div>`:"";
|
||||
// Overall percent (null if unknown) and the running step.
|
||||
const pct=prog.pct!=null?Math.round(prog.pct*100):null,cur=prog.plan.find(stage=>stage.state==="run");
|
||||
// Step chips: skipped / done with duration / running with fraction / pending with estimate.
|
||||
@@ -166,7 +166,7 @@ const chips=prog.plan.map(stage=>stage.state==="skip"?`<span class="st skip" tit
|
||||
// Done-of-total counter and step label.
|
||||
const cnt=prog.total?`${prog.done} di ${prog.total}`:"",step=LBL[prog.step]||prog.step;
|
||||
// Panel markup: header, progress bars, step chips and live status.
|
||||
return `<tr><td colspan=6><div class=pg>
|
||||
return `<tr><td colspan=7><div class=pg>
|
||||
<div class=pgh><span><span class=big>${pct!=null?pct+"%":"…"}</span> <b>${step}</b> <span class=n>— ${E(prog.note||HOW[prog.step]||"")}</span></span>
|
||||
<span><span class=eta>${prog.eta!=null?`fine prevista <b>~${clock(prog.eta)}</b> · mancano <b>${dur(prog.eta)}</b> · `:""}trascorso ${dur(prog.elapsed)}</span> ${stop}</span></div>
|
||||
<div class="bar${pct==null?" ind":""}"><i style="width:${pct||0}%"></i></div>
|
||||
@@ -203,6 +203,10 @@ addEventListener("drop",event=>{event.preventDefault();document.body.classList.r
|
||||
// Meetings per page and current page index (0-based); goPg changes page and re-renders.
|
||||
const PS=100;let pg_=0;
|
||||
function goPg(delta){pg_+=delta;tick()}
|
||||
// Sort by processing date (updated_at): 0 = default (newest name first), -1 = newest first, 1 = oldest first.
|
||||
let srt=0;function sortDt(){srt=srt<0?1:-1;pg_=0;tick()}
|
||||
// SQLite UTC "YYYY-MM-DD HH:MM:SS" shown in local time.
|
||||
const dt=value=>value?new Date(value.replace(" ","T")+"Z").toLocaleString("it-IT",{dateStyle:"short",timeStyle:"short"}):"";
|
||||
// Refresh the whole UI from /status: header, LLM pickers, table.
|
||||
async function tick(){try{const data=await (await fetch("/status")).json();ab.disabled=data.ask_blocked;ab.title=data.ask_blocked?"pipeline in corso":"";
|
||||
// Browser tab title shows the progress of the first running pipeline.
|
||||
@@ -218,16 +222,18 @@ qs.textContent=data.queue?`rielaborazione: ${data.queue} da completare`:"";
|
||||
// Remember step-select values so they survive the re-render.
|
||||
document.querySelectorAll("select[id^=f-]").forEach(select=>sel[select.id]=select.value);
|
||||
// Table header.
|
||||
let html="<thead><tr><th>riunione<th>stato<th>durata<th>speaker<th>dimensione<th>azioni</tr></thead>";
|
||||
let html=`<thead><tr><th>riunione<th>stato<th style="cursor:pointer;user-select:none;white-space:nowrap" onclick=sortDt() title="ordina per data di elaborazione">elaborazione ${srt<0?"▼":srt>0?"▲":"↕"}<th>durata<th>speaker<th>dimensione<th>azioni</tr></thead>`;
|
||||
// Apply the date sort before paging (ISO strings sort lexicographically).
|
||||
const recs=srt?[...data.recs].sort((a,b)=>srt*(a.updated_at||"").localeCompare(b.updated_at||"")):data.recs;
|
||||
// Pagination: PS meetings per page; clamp the page if recordings were removed, then draw the pager.
|
||||
const pages=Math.max(1,Math.ceil(data.recs.length/PS));if(pg_>=pages)pg_=pages-1;
|
||||
pgr.innerHTML=pages>1?`<button ${pg_?"":"disabled"} onclick="goPg(-1)">‹</button><span>pagina ${pg_+1} di ${pages} (${data.recs.length} riunioni)</span><button ${pg_<pages-1?"":"disabled"} onclick="goPg(1)">›</button>`:"";
|
||||
// One tbody per recording on the current page; "running" when the status is done but the process is still alive.
|
||||
for(const row of data.recs.slice(pg_*PS,(pg_+1)*PS)){
|
||||
for(const row of recs.slice(pg_*PS,(pg_+1)*PS)){
|
||||
// Display title, falling back to the upload name.
|
||||
const nm=row.title||row.upload,act=!!(row.prog||row.running||row.status==="queued");
|
||||
// Main row: checkbox, title and rename buttons; status badge with error text and time since last data.
|
||||
html+=`<tbody class=rec><tr class=main><td><input type=checkbox class=mg value="${row.name}"><span class="ttl${act?" act":""}"${act?` onclick="togPg('${row.name}')" title="mostra/nascondi avanzamento"`:""}>${nm?`<b>${E(nm)}</b>${act?"<span class=spin></span>":""}<br><small>${row.name}</small>`:row.name+(act?"<span class=spin></span>":"")}</span><td><span class="b ${row.status}" title="${E(row.error)}">${row.status}</span>${row.receiving_age_s!=null&&row.status==="recording"?` <small>${row.receiving_age_s}s ago</small>`:""}${row.error?`<br><small>${E(row.error)}</small>`:""}<td>${row.duration_s?fmt(row.duration_s):""}<td>${row.speakers??""}<td>${row.mb?row.mb+" MB":""}
|
||||
html+=`<tbody class=rec><tr class=main><td><input type=checkbox class=mg value="${row.name}"><span class="ttl${act?" act":""}"${act?` onclick="togPg('${row.name}')" title="mostra/nascondi avanzamento"`:""}>${nm?`<b>${E(nm)}</b>${act?"<span class=spin></span>":""}<br><small>${row.name}</small>`:row.name+(act?"<span class=spin></span>":"")}</span><td><span class="b ${row.status}" title="${E(row.error)}">${row.status}</span>${row.receiving_age_s!=null&&row.status==="recording"?` <small>${row.receiving_age_s}s ago</small>`:""}${row.error?`<br><small>${E(row.error)}</small>`:""}<td>${dt(row.updated_at)}<td>${row.duration_s?fmt(row.duration_s):""}<td>${row.speakers??""}<td>${row.mb?row.mb+" MB":""}
|
||||
<td><div class=acts><a class="btn pri"${row.files.includes("report.html")?` href="/report?name=${row.name}" target=_blank`:""}>📄 report</a><a class=btn${row.files.includes("report.html")?` href="/pdf?name=${row.name}" target=_blank`:""}>pdf</a><button title="anteprima e ritaglio" ${row.mb?"":"disabled"} onclick="play('${row.name}',${row.duration_s||0},'${E(nm||row.name).replace(/'/g,"")}')">▶ video</button><button title="altre azioni" onclick="more('${row.name}',${row.mb||0},'${E(nm||row.name).replace(/'/g,"")}',${!!(row.mb&&row.status==="done"&&!row.running)},'${E(row.title||row.upload||"").replace(/'/g,"")}',${!!row.files.includes("report.html")},${!!(row.running||row.status==="queued"||row.status==="recording")})">⋯</button></div>`;
|
||||
html+=pgo.has(row.name)?progPanel(row):"";
|
||||
if(open_.has(row.name))html+=await panel(row.name);html+="</tbody>"}
|
||||
|
||||
Reference in New Issue
Block a user