feat: copy legacy OpenAdapt recording system into openadapt-capture#9
Merged
feat: copy legacy OpenAdapt recording system into openadapt-capture#9
Conversation
b6f5a4d to
f9f6a46
Compare
- Action-gated video capture: only encode frames when actions occur (~1-5 fps) instead of every screenshot (24fps). This is the core reason legacy OpenAdapt was smooth — not just separate processes. Matches legacy RECORD_FULL_VIDEO=False default behavior. - Video encoding in separate multiprocessing.Process (avoids GIL) - Screenshots via mss (2-4x faster than PIL.ImageGrab on Windows) - SIGINT ignored in worker process (main handles Ctrl+C) - Non-daemon process ensures video finalization on shutdown - First frame forced as key frame for seekability - Fix wormhole FileNotFoundError on Windows (searches Scripts/ dir) Legacy patterns matched: - prev_screen_event buffering → _prev_screen_frame - prev_saved_screen_timestamp dedup → _prev_saved_screen_timestamp - RECORD_FULL_VIDEO option → record_full_video parameter - SIG_IGN in worker processes - mss with CAPTUREBLT=0 on Windows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f9f6a46 to
f251b2b
Compare
Replace vibe-coded recording internals with proven legacy OpenAdapt code, adapted only for per-capture databases and import paths. New modules (copied from legacy): - db/models.py: SQLAlchemy models (Recording, ActionEvent, Screenshot, WindowEvent, PerformanceStat, MemoryStat) - db/crud.py: batch insert functions, post_process_events - extensions/synchronized_queue.py: multiprocessing queue wrapper - utils.py: timestamps, screenshots, monitor dims - window/: platform-specific active window capture - plotting.py: performance stat visualization Updated modules: - recorder.py: full legacy record() with multi-process writers, action-gated video, stop sequences, SIGINT handling - capture.py: reads from SQLAlchemy DB, fixes session leak, mouse_pressed=None handling, disabled event filtering, adds dx/dy/button properties to Action - config.py: all legacy recording config values - video.py: legacy functional API wrappers - cli.py: wired to new recorder - pyproject.toml: added sqlalchemy, loguru, psutil, tqdm deps Bug fixes: - Reset stop_sequence_detected on re-entry (Recorder reuse) - Close session on error in CaptureSession.load() - Skip click events with mouse_pressed=None - Filter disabled events in raw_events() Tests: 118 passed + 6 performance tests (Windows-only) Docs: updated README.md and CLAUDE.md to match new architecture Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wrap Recorder import in try/except in __init__.py and test files - Skip Recorder tests when pynput unavailable (no display server) - Fix all ruff I001 import sorting violations - Remove unused imports and variables Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Browser bridge tests hang indefinitely on headless CI due to async websocket fixtures. Add pytest-timeout and a 10-minute job timeout. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
New modules (copied from legacy, import paths adapted)
Test plan
Generated with Claude Code