Commit d359011
feat: copy legacy OpenAdapt recording system into openadapt-capture (#9)
* fix: match legacy OpenAdapt recording architecture
- 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>
* feat: copy legacy OpenAdapt recording system into openadapt-capture
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>
* fix: make pynput import conditional for headless CI
- 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>
* fix(ci): exclude browser bridge tests and add timeout
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>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent de00dab commit d359011
File tree
27 files changed
+5876
-562
lines changed- .github/workflows
- openadapt_capture
- db
- extensions
- window
- scripts
- tests
27 files changed
+5876
-562
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
62 | 78 | | |
63 | | - | |
| 79 | + | |
64 | 80 | | |
65 | | - | |
66 | | - | |
67 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
68 | 92 | | |
69 | 93 | | |
70 | | - | |
71 | | - | |
| 94 | + | |
| 95 | + | |
72 | 96 | | |
73 | 97 | | |
74 | 98 | | |
75 | 99 | | |
76 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
77 | 108 | | |
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
81 | 112 | | |
82 | 113 | | |
83 | | - | |
84 | | - | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
75 | 73 | | |
76 | 74 | | |
77 | 75 | | |
| |||
91 | 89 | | |
92 | 90 | | |
93 | 91 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
108 | 122 | | |
109 | 123 | | |
110 | 124 | | |
111 | 125 | | |
112 | 126 | | |
113 | 127 | | |
114 | 128 | | |
115 | | - | |
116 | 129 | | |
117 | 130 | | |
118 | 131 | | |
119 | | - | |
| 132 | + | |
120 | 133 | | |
121 | 134 | | |
122 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
123 | 143 | | |
124 | 144 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
128 | 148 | | |
129 | 149 | | |
130 | | - | |
| 150 | + | |
131 | 151 | | |
132 | | - | |
| 152 | + | |
133 | 153 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 154 | + | |
| 155 | + | |
146 | 156 | | |
147 | 157 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
151 | 163 | | |
152 | | - | |
| 164 | + | |
153 | 165 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 166 | + | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
| |||
191 | 189 | | |
192 | 190 | | |
193 | 191 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | 192 | | |
210 | 193 | | |
211 | 194 | | |
| |||
236 | 219 | | |
237 | 220 | | |
238 | 221 | | |
239 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
240 | 226 | | |
241 | 227 | | |
242 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
19 | 31 | | |
20 | 32 | | |
21 | 33 | | |
| |||
54 | 66 | | |
55 | 67 | | |
56 | 68 | | |
57 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
58 | 76 | | |
59 | 77 | | |
60 | 78 | | |
61 | 79 | | |
62 | 80 | | |
63 | 81 | | |
64 | 82 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
| |||
0 commit comments