From 4ee270c37bc72be665b60dc8fcf8e18cbde6d90b Mon Sep 17 00:00:00 2001 From: Stefano Zini Date: Tue, 10 Nov 2026 14:51:18 +0100 Subject: [PATCH] report: participants as small chips at the end, hidden in the PDF --- app/report.py | 97 +++++++++++++-------------------------------------- app/review.py | 6 ++-- app/server.py | 1 + 3 files changed, 29 insertions(+), 75 deletions(-) diff --git a/app/report.py b/app/report.py index b55ae5d..2e0bd60 100644 --- a/app/report.py +++ b/app/report.py @@ -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 += ["", "", ""] + # 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", + "", + '

' + "".join(f"{person}" for person in people) + "

", + "", + ] 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'{title_text}\n{body}', diff --git a/app/review.py b/app/review.py index a71892b..11ced2c 100644 --- a/app/review.py +++ b/app/review.py @@ -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 "" in line: + people += re.findall(r"(.*?)", line) elif line.strip() and not line.startswith("*"): people += [name_part.strip() for name_part in line.split(",")] # R6: no initials or truncated names. diff --git a/app/server.py b/app/server.py index 74c0365..b543b18 100644 --- a/app/server.py +++ b/app/server.py @@ -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.