diff --git a/docs/pptx-videos.md b/docs/pptx-videos.md index 4a4cb43..3d7f4f8 100644 --- a/docs/pptx-videos.md +++ b/docs/pptx-videos.md @@ -49,7 +49,10 @@ python3 tools/pptx_videos.py presentation.pptx --timings-only --report pdf-dense This creates `timings-dense.pdf` and its editable `timings-dense.typ` source. It has a discreet title containing the presentation name and no summary cards. -Slide numbers and media names are plain text; only durations use pills. +Slide numbers and media names are plain text; durations and loop markers use pills. +Trimmed videos show a discreet line under the media name with the amounts removed +from the start and end. Looping videos carry an amber **Looping** pill next to +their name and a dash instead of a finite duration. The duration caveat stays in a small footnote. Use `--report pdf,pdf-dense` to produce both layouts. @@ -65,6 +68,9 @@ durations. Media size and embedded-video counts still count each file once. **Duration** is the single-play duration after PowerPoint's start and end trims. The full reports also show **Original** duration and **Playback** status. +HTML and both PDF layouts show start/end trim details below the media name and +an amber **Looping** pill for repeated playback. Markdown and TXT include the +trim details in the Playback column. `pdf-dense` retains its three columns; its duration pill shows a status when there is no usable duration. diff --git a/tools/pptx_videos.py b/tools/pptx_videos.py index e44b47e..5e9e076 100644 --- a/tools/pptx_videos.py +++ b/tools/pptx_videos.py @@ -233,6 +233,28 @@ def typst_string(value): ) + '"' +def trim_detail(video): + start = video.get('trim_start_seconds', 0) + end = video.get('trim_end_seconds', 0) + if not (start or end): + return '' + return f'Trim removed · start {time_fmt(start)} · end {time_fmt(end)}' + + +def typst_media(video, dense=False): + """Keep playback annotations with the media, without adding table columns.""" + detail = trim_detail(video) + if not detail and video['playback_status'] != 'looping': + return typst_string(video['name']) + content = '#' + typst_string(video['name']) + if video['playback_status'] == 'looping': + colors = '"#fff0ce", "#805300"' if dense else 'bg: "#fff0ce", fg: "#805300"' + content += f' #pill("Looping", {colors})' + if detail: + content += '\n#par(leading: 2pt, text(size: 7pt, fill: rgb("#626b80"), ' + typst_string(detail) + '))' + return '[' + content + ']' + + def render_report(data, format): if format == 'ontime': return json.dumps(ontime_project(data), ensure_ascii=False, indent=2, allow_nan=False) + '\n' @@ -265,6 +287,9 @@ def render_report(data, format): return json.dumps(data, ensure_ascii=False, indent=2, allow_nan=False) + '\n' if format in ('md', 'txt'): for row, video in zip(cells, report_rows): + detail = trim_detail(video) + if detail: + row[7] += '; ' + detail row[:] = [esc(value) if format == 'md' else value.replace('\n', ' ') for value in row] if format == 'md' and video['extracted_file']: row[2] = f'[{row[2]}]({quote(video["extracted_file"])})' @@ -283,6 +308,12 @@ def render_report(data, format): row[5] = f'{row[5]}' if video['extracted_file']: row[2] = f'{row[2]}' + if video['playback_status'] == 'looping': + row[1] = '—' + row[2] += ' Looping' + detail = trim_detail(video) + if detail: + row[2] += f'{html.escape(detail)}' table_rows.append('