| 195 | } |
| 196 | |
| 197 | async save(extra = {}) { |
| 198 | await mkdir(this.dir, { recursive: true }); |
| 199 | const timeline = await this.page.evaluate(() => window.__probeTimeline ?? []).catch(() => []); |
| 200 | await writeFile(join(this.dir, 'state.json'), JSON.stringify({ title: this.title, entries: this.entries, notes: this.notes, timeline, ...extra }, null, 2)); |
| 201 | const lines = [`# ${this.title}`, '', '| Bild | Was es zeigt | Zeichenflaeche | Kamera |', '|---|---|---|---|']; |
| 202 | for (const entry of this.entries) { |
| 203 | const cam = entry.state?.fit?.camera?.position?.map((v) => v.toFixed(0)).join(', ') ?? ''; |
| 204 | lines.push(`| ${entry.file} | ${entry.note} | ${entry.state?.canvas ?? ''} | ${cam} |`); |
| 205 | } |
| 206 | if (this.notes.length) lines.push('', '## Notizen', '', ...this.notes.map((note) => `- ${note}`)); |
| 207 | await writeFile(join(this.dir, 'index.md'), `${lines.join('\n')}\n`); |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | const wait = (ms) => new Promise((done) => setTimeout(done, ms)); |