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'