feat: Add transcription worker and state management

Introduce an `AppState` struct to hold shared application state,
including configuration and the transcription sender.
Modify `create_router` and `create_router_with_state` to use `AppState`.
Update `main.rs` to initialize the transcription worker and pass the
`AppState` to the router.
Implement the transcription worker logic in
`server/src/transcribe/worker.rs`, handling job queues, FFmpeg remuxing,
and Whisper transcription.
Update `server/src/auth.rs` to use `Arc<Config>` from the shared state.
Modify `server/src/routes/upload.rs` to enqueue transcription jobs and
handle potential errors.
Add `TranscribeJob` and channel types in `server/src/transcribe/mod.rs`.
This commit is contained in:
2026-04-13 16:45:24 +02:00
parent 84f8df2bf4
commit bcae4e5466
7 changed files with 158 additions and 19 deletions
+19
View File
@@ -1,2 +1,21 @@
use std::path::PathBuf;
use tokio::sync::mpsc;
pub mod ffmpeg;
pub mod whisper;
pub mod worker;
pub const QUEUE_DEPTH: usize = 64;
#[derive(Debug, Clone)]
pub struct TranscribeJob {
pub audio_path: PathBuf,
}
pub type TranscribeSender = mpsc::Sender<TranscribeJob>;
pub type TranscribeReceiver = mpsc::Receiver<TranscribeJob>;
pub fn channel() -> (TranscribeSender, TranscribeReceiver) {
mpsc::channel(QUEUE_DEPTH)
}