From a0ed2ab7bdffecd1dd11b516aefee660bc9c936d Mon Sep 17 00:00:00 2001 From: Azeufack Noupeu Willy Date: Thu, 20 Nov 2025 14:05:52 +0100 Subject: [PATCH 1/4] feat(extraction): add audio_ready event emission - Add EventEmitter to emit audio_ready when extraction completes - Pass sessionId and audioPath in event data - Export audioEvents for Main process orchestrator Refs: S3-06 AC1,AC3,AC7 --- services/modules/extraction/ffmpegExtractor.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/modules/extraction/ffmpegExtractor.js b/services/modules/extraction/ffmpegExtractor.js index ffec9c0..7939cd5 100644 --- a/services/modules/extraction/ffmpegExtractor.js +++ b/services/modules/extraction/ffmpegExtractor.js @@ -1,3 +1,5 @@ +const EventEmitter = require('events'); +const audioEvents = new EventEmitter(); // Ensure ffmpeg binary is available if (!ffmpegPath) { @@ -75,6 +77,12 @@ module.exports = { progressBar.update(100, { timemark: 'done' }); progressBar.stop(); console.log(`Extraction completed: ${outputAudioPath}`); + + audioEvents.emit('audio_ready', { + sessionId: inputVideoName, + audioPath: outputAudioPath + }); + resolve(); }) .on('error', (err) => { @@ -88,6 +96,6 @@ module.exports = { console.log(); } }); - } - + }, + audioEvents: audioEvents } \ No newline at end of file From 68136594436f10a155a15ed1ac920cea65b98b69 Mon Sep 17 00:00:00 2001 From: Azeufack Noupeu Willy Date: Thu, 20 Nov 2025 14:31:26 +0100 Subject: [PATCH 2/4] feat(main): add pipeline orchestrator for auto-transcription --- electron/main/main.js | 59 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/electron/main/main.js b/electron/main/main.js index 3861ad3..06d5a96 100644 --- a/electron/main/main.js +++ b/electron/main/main.js @@ -2,6 +2,9 @@ import { app, BrowserWindow, ipcMain, dialog } from 'electron'; import { exec } from 'child_process'; import path from 'path'; import { fileURLToPath } from 'url'; +// Import audio events and transcription module +import { audioEvents } from '../../services/modules/extraction/ffmpegExtractor.js'; +import { transcribe } from '../../services/modules/transcription-remote/assembly.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -22,7 +25,61 @@ function createWindow() { mainWindow.loadFile('main/index.html'); } -app.whenReady().then(createWindow); +// Setup pipeline orchestrator +function setupOrchestrator() { + console.log('🎯 [Pipeline] Orchestrator ready. Listening for audio_ready events...'); + + audioEvents.on('audio_ready', async (data) => { + const { audioPath, sessionId } = data; + + console.log(`✅ [Pipeline] Audio ready: ${sessionId}`); + + // AC6: Send status to UI - Audio bereit + mainWindow.webContents.send('pipeline-status', { + sessionId, + status: 'audio_ready', + message: 'Audio bereit' + }); + + try { + // AC4: Status transcription_started + console.log(`🚀 [Pipeline] Starting transcription: ${sessionId}`); + mainWindow.webContents.send('pipeline-status', { + sessionId, + status: 'transcription_started', + message: 'Transkription gestartet' + }); + + // AC2: Auto-start transcription (S2-02b) + await transcribe(audioPath, sessionId); + + // AC6: Status transcription_completed + console.log(`✅ [Pipeline] Transcription completed: ${sessionId}`); + mainWindow.webContents.send('pipeline-status', { + sessionId, + status: 'transcription_completed', + message: 'Transkription abgeschlossen' + }); + + } catch (error) { + // AC5: Error logging + failed_transcription_start + console.error(`❌ [Pipeline] Transcription failed: ${sessionId}`); + console.error(` Error:`, error.message); + + mainWindow.webContents.send('pipeline-status', { + sessionId, + status: 'failed_transcription_start', + message: 'Fehler beim Transkriptionsstart', + error: error.message + }); + } + }); +} + +app.whenReady().then(() => { + createWindow(); + setupOrchestrator(); +}); // Kommunikation vom Renderer (Frontend) ipcMain.handle('convert-video', async (event, filePath) => { From 911cba14fde30476a9b07879bff3a1db9db8bc41 Mon Sep 17 00:00:00 2001 From: Azeufack Noupeu Willy Date: Thu, 20 Nov 2025 14:34:07 +0100 Subject: [PATCH 3/4] chore(typescript): add @ts-ignore for assembly module import --- services/pipeline/jobs/transcribeLatest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/services/pipeline/jobs/transcribeLatest.ts b/services/pipeline/jobs/transcribeLatest.ts index fc75ad5..f632eee 100644 --- a/services/pipeline/jobs/transcribeLatest.ts +++ b/services/pipeline/jobs/transcribeLatest.ts @@ -1,6 +1,7 @@ // services/pipeline/jobs/transcribeLatest.ts import path from 'path'; import fs from 'fs'; +// @ts-ignore: module has no type declarations or cannot be resolved in current TS config import assembly from '../../modules/transcription/assembly'; /** From 925eb33eab45c084e9386ada66d9cb14b966e312 Mon Sep 17 00:00:00 2001 From: Azeufack Noupeu Willy Date: Thu, 20 Nov 2025 15:42:03 +0100 Subject: [PATCH 4/4] chore: add .env.example template for AssemblyAI API key --- .env.example | Bin 0 -> 70 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000000000000000000000000000000000..e12a03aecd9e91b2fb46e4026d59397eef09b281 GIT binary patch literal 70 zcmezW&ygV*2wfR`8Jrk=7$O-Q89W){fn)%f_6EvCGS~vKKSL-(5Ksmp63^fPlnDZ2 IUIs1(0PtrE*8l(j literal 0 HcmV?d00001