diff --git a/docs/pptx-videos.md b/docs/pptx-videos.md index 98b16d9..449af96 100644 --- a/docs/pptx-videos.md +++ b/docs/pptx-videos.md @@ -23,15 +23,16 @@ for editing. HTML and Typst/PDF include colored summary cards and pills; Markdown and TXT use aligned tables. JSON includes numeric durations in seconds, sizes in bytes, and slide references. -For a compact portrait PDF with only slide numbers and duration pills: +For a compact portrait PDF with slide numbers, media names, and duration pills: ```sh python3 tools/pptx_videos.py presentation.pptx --timings-only --report pdf-dense ``` This creates `timings-dense.pdf` and its editable `timings-dense.typ` source. -There are no summary cards or video metadata columns. Slide numbers are plain -text; only durations use pills. The duration caveat stays in a small footnote. +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. +The duration caveat stays in a small footnote. Use `--report pdf,pdf-dense` to produce both layouts. Timings require `ffprobe` (from FFmpeg); PDF additionally requires `typst` on diff --git a/tests/test_pptx_videos.py b/tests/test_pptx_videos.py index f721b43..f8da712 100644 --- a/tests/test_pptx_videos.py +++ b/tests/test_pptx_videos.py @@ -214,14 +214,15 @@ class VideoTests(unittest.TestCase): self.assertTrue((self.root / 'timings.typ').is_file()) self.assertEqual((self.root / 'timings.pdf').read_bytes(), b'%PDF-test') - def test_dense_pdf_is_portrait_with_only_slide_and_duration_columns(self): + def test_dense_pdf_has_portrait_media_table_and_discreet_title(self): source = videos.render_report(self.report(), 'pdf-dense') self.assertNotIn('flipped: true', source) - self.assertIn('columns: (1fr, auto)', source) - self.assertIn('table.header(strong("Slide(s)"), strong("Duration"))', source) - self.assertIn('"2, 12", pill("00:00:01.000"', source) - self.assertIn('"Unreferenced", pill("Unknown"', source) - for unwanted in ('metric(', 'Embedded videos', 'Total duration', 'clip.mp4', 'Resolution', 'Codec'): + self.assertIn('columns: (30mm, 1fr, auto)', source) + self.assertIn('table.header(strong("Slide(s)"), strong("Media"), strong("Duration"))', source) + self.assertIn('"2, 12", "A #1.mp4", pill("00:00:01.000"', source) + self.assertIn('"Unreferenced", "unused.mp4", pill("Unknown"', source) + self.assertIn('#par(text(size: 10pt, fill: rgb("#626b80"), "Video timings — Review & plans.pptx"))', source) + for unwanted in ('metric(', 'Embedded videos', 'Total duration', 'Resolution', 'Codec'): self.assertNotIn(unwanted, source) self.assertIn('text(size: 7pt', source) self.assertIn('trimming', source) diff --git a/tools/pptx_videos.py b/tools/pptx_videos.py index 9a4fae2..50465df 100644 --- a/tools/pptx_videos.py +++ b/tools/pptx_videos.py @@ -297,17 +297,19 @@ def render_report(data, format): '#set par(justify: false)', '#let pill(body, bg, fg) = box(fill: rgb(bg), radius: 20pt,', ' inset: (x: 7pt, y: 2pt), text(size: 8pt, fill: rgb(fg), body))', + '#par(text(size: 10pt, fill: rgb("#626b80"), ' + typst_string(title) + '))', + '#v(4pt)', '#table(', - ' columns: (1fr, auto),', - ' align: (left + horizon, right + horizon),', + ' columns: (30mm, 1fr, auto),', + ' align: (left + horizon, left + horizon, right + horizon),', ' inset: (x: 8pt, y: 4pt),', ' stroke: (top: none, left: none, right: none, bottom: 0.4pt + rgb("#e2e6f0")),', ' fill: (x, y) => if y == 0 { rgb("#eeeafd") } else if calc.even(y) { rgb("#f8f9fc") },', - ' table.header(strong("Slide(s)"), strong("Duration")),', + ' table.header(strong("Slide(s)"), strong("Media"), strong("Duration")),', ] for row, video in zip(cells, data['videos']): bg, fg = ('#e3f4ee', '#176349') if video['duration_seconds'] is not None else ('#fff0ce', '#805300') - lines.append(f' {typst_string(row[0])}, pill({typst_string(row[1])}, "{bg}", "{fg}"),') + lines.append(f' {typst_string(row[0])}, {typst_string(row[2])}, pill({typst_string(row[1])}, "{bg}", "{fg}"),') lines += [')', '#v(6pt)'] lines += ['#par(text(size: 7pt, fill: rgb("#626b80"), ' + typst_string(note) + '))' for note in notes] return '\n'.join(lines) + '\n'