Skip to content

fix(helpers): make timeline_view and transcribe run on Windows#80

Closed
Pcecil21 wants to merge 9 commits into
browser-use:mainfrom
Pcecil21:fix/windows-fonts-and-console
Closed

fix(helpers): make timeline_view and transcribe run on Windows#80
Pcecil21 wants to merge 9 commits into
browser-use:mainfrom
Pcecil21:fix/windows-fonts-and-console

Conversation

@Pcecil21

@Pcecil21 Pcecil21 commented Jun 20, 2026

Copy link
Copy Markdown

Motivation / Context

This completes the Windows-portability sweep started in #78 (cp1252 console + ffmpeg path) and #79 (subtitles-filter path escaping). Two CLI helpers were never touched by those fixes and still break on Windows.

What's fixed

helpers/timeline_view.py

  • FONT_CANDIDATES listed only macOS and Linux font paths. On Windows every candidate failed Path.exists(), so load_font fell through to PIL's default bitmap font — which ignores the requested size — and the filmstrip labels rendered nearly illegibly. Added %WINDIR%-derived Consolas + Arial candidates (drive-correct, not hardcoded to C:).
  • Forced UTF-8 on stdout/stderr so a non-ASCII output path in the status print doesn't raise UnicodeEncodeError on a cp1252 console.

helpers/transcribe.py

  • Forced UTF-8 on stdout/stderr for the same reason — it prints the video filename, which crashes the helper on Windows when the name is non-ASCII (accents, emoji, CJK).

Tests

Adds tests/test_timeline_fonts.py (cross-platform): pins the candidate list, the %WINDIR%-derived font dir, that the original POSIX candidates are preserved, and that load_font never raises. All 7 tests (new + existing subtitles) pass on Windows and Linux.

Risk / caveats

No behavior change on macOS/Linux — the new font paths simply never match there, and the UTF-8 reconfigure is a no-op when the stream is already UTF-8. The transcribe.py JSON write was already ASCII-safe (json.dumps defaults ensure_ascii=True) and was intentionally left untouched.

🤖 Generated with Claude Code


Summary by cubic

Make the CLI helpers run reliably on Windows by fixing console encoding, ffmpeg metadata path parsing, and Windows font selection for timeline labels. Adds tests and small repo hygiene (LF enforcement and .claude/ ignore), plus updates to SKILL.md and a new decisions.md entry recording ElevenLabs approval.

  • Bug Fixes
    • timeline_view.py: add Windows font candidates from %WINDIR%\Fonts (Consolas, Arial); force UTF-8 on stdout/stderr to avoid UnicodeEncodeError.
    • transcribe.py: force UTF-8 on stdout/stderr so non-ASCII filenames don’t crash.
    • grade.py: write ffmpeg metadata using cwd + bare filename to avoid : and \ in filtergraphs; also force UTF-8 on stdout/stderr.
    • pack_transcripts.py, render.py, transcribe_batch.py: force UTF-8 on stdout/stderr for Windows consoles.
    • Tests: add tests/test_timeline_fonts.py and tests/test_grade_path.py to pin Windows/POSIX behavior.

Written for commit 3bc5a03. Summary will update on new commits.

Review in cubic

Pcecil21 and others added 9 commits May 5, 2026 14:13
Marks the skill as caution-risk to reflect the compliance gate in
decisions.md (ElevenLabs Scribe sends audio off-machine; no client
PII until John's ADV review). Frontmatter-only; LF endings preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
Prevents a Windows editor from re-flipping .md files to CRLF, which
produces unreviewable whole-file diffs (the SKILL.md incident). Only
governs *.md; existing files are left untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
CRLF in a shell script breaks execution on Linux/Codex, which the
README markets support for. The existing rule only covered *.md;
this extends LF enforcement to executable source. Files are already
LF, so renormalize is a no-op — this is preventive hardening.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
…tent

Supersedes the 2026-04-24 restriction. John approved the ElevenLabs
Scribe data flow for full client content, unconditional, verbal. The
gate barring client-PII audio from this skill is lifted. Old entry
kept intact; lift recorded on top. Open item: capture a written
confirmation into the ADV file for the audit trail.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
…roval

ElevenLabs data flow cleared for full client content (decisions.md
2026-06-19), so the skill is no longer caution-gated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
Three cross-platform bugs surfaced running on a Windows (cp1252) console:

1. UnicodeEncodeError on the '→'/'—' chars in status print() calls —
   Windows stdout defaults to cp1252 and can't encode them. grade.py
   crashed before grading; pack_transcripts.py crashed after writing.
   Fix: force UTF-8 on stdout/stderr at import in the four helpers that
   print non-ASCII (no-op where already UTF-8).

2. grade.py --analyze passed a Windows temp path into the ffmpeg
   'metadata=print:file=...' filter, where ':' and '\' are filtergraph
   delimiters, so ffmpeg errored out. Fix: pass a bare filename and set
   ffmpeg's cwd to the file's directory (_metadata_filter_target), so no
   path ever reaches the filtergraph parser.

Adds tests/test_grade_path.py pinning the filter-target invariant.
Verified: pack_transcripts and grade --analyze both run clean on
Windows with no PYTHONUTF8 workaround.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls7GRoTW8Nh4Bm3DKg8TWC
Completes the Windows-portability sweep across the CLI helpers. Two helpers
were never touched by the earlier fixes (cp1252 console + ffmpeg paths):

- timeline_view.py: FONT_CANDIDATES listed only macOS/Linux font paths, so on
  Windows every candidate missed and load_font fell to PIL's default bitmap
  font (which ignores the requested size), rendering filmstrip labels nearly
  illegibly. Add %WINDIR%-derived Consolas + Arial candidates (drive-correct,
  not hardcoded C:). Also force UTF-8 on stdout/stderr so a non-ASCII output
  path in the status print doesn't raise UnicodeEncodeError on a cp1252 console.

- transcribe.py: force UTF-8 on stdout/stderr for the same reason — it prints
  the video filename, which crashes the helper on Windows if non-ASCII.

Adds tests/test_timeline_fonts.py (cross-platform; pins the candidate list,
the %WINDIR%-derived font dir, and that load_font never raises). All 7 tests
pass on Windows and Linux. No behavior change on macOS/Linux.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMuYbKwjCCvuaB6i75DDsF

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 12 files

Re-trigger cubic

@Pcecil21

Copy link
Copy Markdown
Author

Closing — this PR was accidentally branched off a local main that carried unrelated local files. Reopening a clean PR branched from upstream main with only the intended helper changes.

@Pcecil21 Pcecil21 closed this Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant