diff --git a/scraper/internal/orchestrator/orchestrator_test.go b/scraper/internal/orchestrator/orchestrator_test.go index d1366c6..b73d9eb 100644 --- a/scraper/internal/orchestrator/orchestrator_test.go +++ b/scraper/internal/orchestrator/orchestrator_test.go @@ -173,6 +173,18 @@ func (s *mockStore) UpdateScrapeTask(_ context.Context, _ string, _ storage.Scra func (s *mockStore) ListScrapeTasks(_ context.Context) ([]storage.ScrapeTask, error) { return nil, nil } +func (s *mockStore) CreateAudioJob(_ context.Context, _ string, _ int, _ string) (string, error) { + return "audio-job-id", nil +} +func (s *mockStore) UpdateAudioJob(_ context.Context, _, _, _ string, _ time.Time) error { + return nil +} +func (s *mockStore) GetAudioJob(_ context.Context, _ string) (storage.AudioJob, bool, error) { + return storage.AudioJob{}, false, nil +} +func (s *mockStore) ListAudioJobs(_ context.Context) ([]storage.AudioJob, error) { + return nil, nil +} // ── helpers ─────────────────────────────────────────────────────────────────── diff --git a/scraper/internal/server/handlers_audio.go b/scraper/internal/server/handlers_audio.go index f756c29..5c19111 100644 --- a/scraper/internal/server/handlers_audio.go +++ b/scraper/internal/server/handlers_audio.go @@ -16,17 +16,15 @@ import ( // // handleAudioGenerate handles POST /api/audio/{slug}/{n}. // -// It calls Kokoro's POST /v1/audio/speech with return_download_link=true. -// Kokoro generates the audio, saves it to its own temp storage, and returns -// the download filename in the X-Download-Path response header. -// We cache that filename (in memory, keyed by slug/chapter/voice) and -// return a proxy URL that the browser sets as audio.src. +// The handler is non-blocking: it creates an audio_jobs record in PocketBase +// with status="pending", then fires a background goroutine to call Kokoro. +// The caller should poll GET /api/audio/status/{slug}/{n} to track progress. // -// TTS is always generated at speed 1.0; playback speed is controlled -// client-side via the