Stream beets imports over HTTP.
README.md

goosefoot #

Streaming HTTP daemon for beets.

API #

  • GET /health — Service status and beets version.
  • POST /import — Runs import pipeline for a path inside GOOSEFOOT_IMPORT_DIR; streams logs via SSE (Accept: text/event-stream).
{
  "path": "/music/imports/album",
  "mb_url": "https://musicbrainz.org/release/<uuid>",
  "dry_run": false
}

Pipeline: import (-I -S) followed by any executable scripts in GOOSEFOOT_HOOKS_DIR (queued sequentially; detached from client disconnects once accepted). Set dry_run: true to preview immediately without writing changes or queueing.

Post-Import Hooks #

When GOOSEFOOT_HOOKS_DIR is set, executable regular files (and symlinks to executables) in that directory run in lexical order after beet import succeeds. Dotfiles and non-executable files are ignored. Each step gets a 15-minute timeout; hook failures log a warning over SSE and continue to subsequent hooks.

  • SSE step name: Derived from filename by stripping any leading NN-/NN_ prefix and file extension (e.g. 10-lyrics.sh → lyrics).
  • Environment: IMPORT_PATH, MB_URL, MB_ID, BEETS_BIN, PYTHONUNBUFFERED=1.
#!/bin/sh
# /config/hooks.d/10-lyrics
exec "$BEETS_BIN" lyrics "mb_albumid:$MB_ID"

Configuration #

Variable              Default  Description
GOOSEFOOT_API_KEY     (none)   Required bearer token (Authorization: Bearer <token>)
GOOSEFOOT_IMPORT_DIR  (none)   Required root directory confining allowed import paths
GOOSEFOOT_HOST        ""       Bind host (empty binds all interfaces)
GOOSEFOOT_PORT        8080     Listen port
GOOSEFOOT_HOOKS_DIR   ""       Directory of executable post-import hooks (optional)
BEETS_BIN             beet     Path to beets binary
LOG_LEVEL             info     debug, info, warn, error
FORCE_COLOR           false    Force ANSI color output in terminal logs (1 or true)

Usage #

go build -o goosefoot ./cmd/goosefoot
./goosefoot