feat(spotify): GoLibrespotBackend sidecar (FIFO + ffmpeg PCM + REST/WS)

Implements SpotifyAudioBackend over a go-librespot sidecar: start() mkfifos
the pipe, spawns the FIFO->48k s16le ffmpeg reader BEFORE go-librespot, writes
config.yml, polls the REST /  until ready, then connects the WS event stream.
Maps not_playing/stopped -> trackEnded and metadata -> SpotifyNowPlaying;
play/pause/resume/seek delegate to the REST client. All child_process/fs/REST/WS
seams are injectable so the lifecycle is fully unit-tested without a real binary.

Correction C1: ffmpeg is resolved via getFfmpegCommand() (now exported from
src/audio/player.ts) so the bundled ffmpeg-static fallback is honored in Docker;
the ffmpeg command is overridable via deps.ffmpegCommand for tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
saopig1andClaude Opus 4.8 committed 2026-07-02 20:58:13 +08:00
1 parent f2b14b5f00
commit 9d55bea240
3 files changed
+495 -1

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ const resolvedFfmpeg: string = (() => {
return "ffmpeg";
})();
function getFfmpegCommand(): string {
export function getFfmpegCommand(): string {
return resolvedFfmpeg;
}