6.1 KiB
Agent usage
museater is designed so an agent can call it like any other shell tool. From
the repository use uv run museater ...; if installed as a uv tool, use
museater .... The machine contract is:
- stdout: exactly one JSON object, and nothing else;
- stderr: human logs, warnings, progress;
- exit code: stable category (see below);
- no prompts when
--non-interactiveis set or stdin is not a TTY.
Discover the contract
uv run museater schema
uv run museater --json doctor
museater schema returns a JSON Schema for the result envelope. The envelope
is stable:
{
"schema_version": "1",
"ok": true,
"command": "qobuz.search",
"data": {},
"warnings": [],
"error": null
}
On failure ok is false, data is null, and error contains code,
message, retryable, and optionally hint/details.
Exit codes
| Code | Meaning |
|---|---|
| 0 | success |
| 2 | usage or configuration error |
| 3 | authentication required/invalid/expired |
| 4 | not found, unavailable, or geo-blocked |
| 5 | network or rate-limit error |
| 6 | partial success (some tracks failed) |
| 7 | storage/permission error |
| 10 | internal error |
| 130 | cancelled by SIGINT/SIGTERM |
Recommended agent sequence
# 1. Is the environment ready?
uv run museater --json doctor
# 2. If auth is missing, use the headless OAuth flow.
uv run museater --json qobuz auth --print-url
# Agent shows oauth_url to the user, waits for the redirect URL.
uv run museater --json qobuz auth --code '<redirect-url>'
# 3. Find the release.
uv run museater --json qobuz search "Daft Punk Discovery" --type album --limit 5
# 4. Inspect it before downloading.
uv run museater --json qobuz info https://play.qobuz.com/album/qxjbxh1dc3xyb
# 5. Download, non-interactively.
uv run museater --json --non-interactive qobuz download \
https://play.qobuz.com/album/qxjbxh1dc3xyb \
--out "$HOME/Music/Museater"
# 6. Inspect history and stats.
uv run museater --json history --limit 20
uv run museater --json stats
Progress events
With --json, progress defaults to NDJSON on stderr (--progress ndjson).
Events:
{"event":"album_start","title":"...","tracks":14,"output_dir":"..."}
{"event":"track_start","index":1,"total":14,"track_id":"...","title":"..."}
{"event":"track_progress","track_id":"...","bytes":1048576,"total":40000000}
{"event":"track_done","index":1,"total":14,"track_id":"...","status":"downloaded","path":"...","bytes":40000000}
{"event":"album_done","status":"completed","downloaded":14,"skipped":0,"failed":0}
Use --progress off for quiet agents, --progress text for humans, and
--concurrency N to cap parallel track downloads. --delay > 0 forces
sequential downloads with a pause between tracks.
Collections
qobuz download accepts album, track, playlist, artist, and label URLs (or
bare IDs with --type). Playlists are downloaded flat with an .m3u8 in API
order; --playlist-as-albums routes tracks into their original album folders.
qobuz favorites --type albums|tracks|artists|labels downloads the favorites
from the authenticated account. It is download-only; there is no listing mode.
tracks favorites go into a flat Favorites Tracks folder with an .m3u8.
Spotify
spotify playlists and spotify playlist are read-only metadata commands.
spotify import matches each track to Qobuz (ISRC first) and downloads only
matched tracks; ambiguous/not_found are reported and skipped.
uv run museater --json spotify auth --client-id <id> --print-url
uv run museater --json spotify auth --code '<redirect-url>'
uv run museater --json spotify playlists
uv run museater --json spotify playlist '<url>'
uv run museater --json spotify import '<url>' --dry-run
uv run museater --json spotify import '<url>' --out ~/Music/Museater
Setup and limitations: spotify.md.
ReplayGain
FLAC gets REPLAYGAIN_TRACK_GAIN/REPLAYGAIN_TRACK_PEAK Vorbis comments; MP3
gets TXXX frames with the same names. Disable with --no-replaygain.
The values come from Qobuz audio_info; audio is not modified.
Lyrics
--lyrics enables lyrics during a download; default providers are Qobuz
native, then LRCLIB. --synced-only rejects plain-text lyrics.
--lyrics-sources qobuz,lrclib selects providers. --lrc-files writes an
.lrc sidecar; without it lyrics are only embedded in the audio tags.
uv run museater --json qobuz download <url> --lyrics --synced-only
uv run museater --json lyrics ~/Music/Museater --overwrite --synced-only
The lyrics command scans .flac/.mp3 recursively, reads existing tags
(including QOBUZTRACKID), and does not require re-downloading audio. It is
best-effort: not_found is not an error.
Cancellation
Send SIGINT or SIGTERM to the process. museater stops starting new tracks,
cancels queued work, keeps direct-download .part files plus their metadata
sidecars, writes an incomplete album marker, and exits with code 130:
{"ok":false,"error":{"code":"CANCELLED","message":"Download cancelled by user","retryable":true},"data":{"summary":{"cancelled":2}}}
Rerun the same command to resume: existing files are skipped and partial direct
downloads resume from their .part file. --force discards partial state.
A target already recorded at the requested quality (or better) is reported as
status: "skipped_db" with summary.skipped > 0 and a db.hit = true block.
This is a success, not an error. Use --force to re-download or --no-db to
ignore the history.
Environment
MUSEATER_QOBUZ_TOKEN— highest-priority token source; never written to disk.MUSEATER_CONFIG— config file path.MUSEATER_OUTPUT_DIR— default download directory.MUSEATER_DATA_DIR/MUSEATER_CACHE_DIR— state and cache directories.
Rules for agents
- Do not parse human output; always pass
--json. - Treat
ok: falseas a failure even when the process exit code is6(partial). Readerroranddata.tracksfor details. - Do not retry
AUTH_*,NOT_FOUND, orGEO_BLOCKED. - Retry
NETWORK/RATE_LIMITEDwith backoff, or lower--concurrency. - Never print or persist
MUSEATER_QOBUZ_TOKENin logs.