Files
Claude f9e1eb82c4 feat: komplette Codebase vom Board ins Repo gespiegelt
app/ = /opt/callrec (Node-Backend, Vite-Frontend, Python-Inferenz,
Audio-Skripte, rkllm_server.cpp), system/ = systemd-Units,
WirePlumber/PipeWire-Drop-ins, sudoers. Modelle, Binaries, Aufnahmen
und node_modules bleiben draussen (.gitignore).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 11:18:29 +02:00

24 lines
1.1 KiB
JavaScript

import fs from 'node:fs';
import { execFileSync } from 'node:child_process';
import * as db from './db.js';
const wav = '/tmp/test.wav';
const WH = '/opt/whisper.cpp/build/bin/whisper-cli';
const MODEL = '/opt/whisper.cpp/models/ggml-small.bin';
execFileSync('ffmpeg', ['-y', '-i', wav, '-codec:a', 'libmp3lame', '-qscale:a', '4', '/opt/callrec/recordings/test.mp3']);
execFileSync(WH, ['-m', MODEL, '-f', wav, '-l', 'de', '-ml', '1', '-sow', '-oj', '-of', '/tmp/test'], { maxBuffer: 1 << 24 });
const j = JSON.parse(fs.readFileSync('/tmp/test.json', 'utf8'));
const words = []; let tr = '';
for (const s of j.transcription || []) {
const t = (s.text || '').trim(); if (!t) continue;
words.push({ word: t, t_start_ms: s.offsets.from, t_end_ms: s.offsets.to });
tr += (tr ? ' ' : '') + t;
}
const durMs = words.length ? words[words.length - 1].t_end_ms : 0;
const id = await db.addRecording({ title: 'Selbsttest (deutsche TTS)', mp3_file: 'test.mp3', device: 'test', duration_ms: durMs, transcript: tr, language: 'de', status: 'done' });
await db.addWords(id, words);
console.log('SEEDED id=' + id + ' words=' + words.length + ' text="' + tr + '"');
process.exit(0);