fix(helpers): make timeline_view and transcribe run on Windows#81
Open
Pcecil21 wants to merge 1 commit into
Open
fix(helpers): make timeline_view and transcribe run on Windows#81Pcecil21 wants to merge 1 commit into
Pcecil21 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation / Context
This completes the Windows-portability sweep started in #78 (
cp1252console + 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.pyFONT_CANDIDATESlisted only macOS and Linux font paths. On Windows every candidate failedPath.exists(), soload_fontfell through to PIL's default bitmap font (which ignores the requested size), rendering the filmstrip labels nearly illegibly. Added%WINDIR%-derived Consolas + Arial candidates (drive-correct, not hardcoded toC:).stdout/stderrso a non-ASCII output path in the status print doesn't raiseUnicodeEncodeErroron a cp1252 console.helpers/transcribe.pystdout/stderrfor 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 thatload_fontnever raises. Passes 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.pyJSON write was already ASCII-safe (json.dumpsdefaultsensure_ascii=True) and was intentionally left untouched.🤖 Generated with Claude Code
Summary by cubic
Fixes Windows support for helpers by adding
%WINDIR%-derived font candidates (Consolas/Arial) intimeline_view.pyand forcing UTF-8 on stdout/stderr in both helpers to avoid cp1252 UnicodeEncodeError. Adds a cross-platform test to pin font candidates and ensureload_fontis resilient; no behavior change on macOS/Linux.Written for commit 4957119. Summary will update on new commits.