museater
Agent-friendly music downloader and library tooling.
Qobuz is the download provider; Spotify is a metadata/import source.
The project is GPL-3.0-only and derives from the qobuz-dl family; see
THIRD_PARTY_NOTICES.md and LICENSE.
Status
Qobuz: albums, tracks, playlists, artists, labels, favorites, direct and
segmented downloads, FLAC/MP3 tags, covers, ReplayGain, lyrics, .m3u8,
SQLite history/dedupe, resume, cancellation, concurrency, and NDJSON progress.
Spotify: OAuth PKCE, playlist/track listing, ISRC-first matching to Qobuz, and
import of matched tracks through the same download pipeline. See
docs/spotify.md for the Spotify app/Premium setup.
Run with uv
Everything is managed by uv; you do not need to create a virtualenv or install Python yourself. From the repository:
# Run the CLI directly (uv creates/syncs .venv and downloads Python 3.12 if needed)
uv run museater --help
uv run museater qobuz auth --no-browser
# Development: tests, lint
uv sync --extra dev
uv run --extra dev pytest
uv run --extra dev ruff check .
Install the museater command globally in an isolated uv tool environment:
uv tool install .
museater --version
Or run it one-off without installing:
uvx --from . museater --help
ffmpeg is required for the segmented download fallback. Install it with your
distribution package manager.
Authenticate
Interactive (opens the Qobuz sign-in page and captures the OAuth callback):
uv run museater qobuz auth
Headless / agent flow:
# 1. Print the OAuth URL, open it anywhere, then copy the full redirect URL.
uv run museater --json qobuz auth --print-url
# 2. Exchange the redirect URL (or just the code).
uv run museater --json qobuz auth --code 'https://www.qobuz.com/...?code=...'
# Or paste a browser token from localStorage.localuser.token:
uv run museater --json qobuz auth --token '<user_auth_token>'
Token resolution order:
MUSEATER_QOBUZ_TOKENenvironment variable (never persisted);- OS keyring (
keyring), unless--no-keyring; ~/.config/museater/credentials.jsonwith mode0600.
Usage
# Human output
uv run museater qobuz auth --status
uv run museater qobuz search "Daft Punk" --type album --limit 5
uv run museater qobuz info https://play.qobuz.com/album/qxjbxh1dc3xyb
uv run museater doctor
# Agent output: one JSON object on stdout, progress/logs on stderr
uv run museater --json qobuz auth --status
uv run museater --json qobuz search "Daft Punk" --type album --limit 5
uv run museater --json qobuz info qxjbxh1dc3xyb
uv run museater --json doctor
uv run museater --json history --limit 20
uv run museater --json stats
uv run museater schema
# Progress control (auto = ndjson with --json, text on a TTY, off otherwise)
uv run museater --json qobuz download <url> --progress ndjson --concurrency 3
uv run museater qobuz download <url> --progress text --concurrency 1
# Lyrics during download
uv run museater qobuz download <url> --lyrics
uv run museater qobuz download <url> --lyrics --lyrics-sources lrclib --synced-only
uv run museater qobuz download <url> --lyrics --lrc-files --overwrite-lyrics
# Retroactively add/repair lyrics in an existing library
uv run museater lyrics ~/Music/Museater --synced-only
uv run museater --json lyrics ~/Music/Museater --overwrite --lrc-files
# Playlists, artists, labels
uv run museater qobuz download <playlist-url> --out ~/Music/Museater
uv run museater qobuz download <artist-url> --out ~/Music/Museater --concurrency 3
uv run museater qobuz download <label-url> --out ~/Music/Museater
uv run museater qobuz download <playlist-url> --playlist-as-albums
# Favorites (download only)
uv run museater qobuz favorites --type albums
uv run museater qobuz favorites --type tracks --out ~/Music/Museater
# Spotify -> Qobuz
uv run museater spotify auth --client-id <spotify-client-id>
uv run museater --json spotify playlists
uv run museater --json spotify playlist '<spotify-playlist-url>'
uv run museater --json spotify import '<spotify-playlist-url>' --dry-run
uv run museater spotify import '<spotify-playlist-url>' --out ~/Music/Museater
See docs/spotify.md for the Spotify app/Premium setup and
the 127.0.0.1 redirect URI requirement.
The download history lives in ~/.local/share/museater/museater.db. A release
is skipped when a completed record at the requested quality (or better) still
exists. If the album folder was renamed, a .museater.json marker inside it is
used to find the new path. --force re-downloads; --no-db ignores the
history.
Global agent flags: --json, --quiet, --verbose, --non-interactive,
--config PATH. Exit codes: 0 success, 2 usage/config, 3 auth, 4 not
found/unavailable, 5 network/rate limit, 6 partial, 7 storage, 10
internal, 130 cancelled (SIGINT/SIGTERM). See
docs/agents.md for the full agent contract.
Configuration
Defaults work without a config file. Optional config lives at
~/.config/museater/config.toml:
[general]
output_dir = "~/Music/Museater"
non_interactive = false
[qobuz]
quality = 27
auto_downgrade = true
concurrency = 3
delay = 0.0 # > 0 forces sequential downloads and sleeps between tracks
folder_format = "{album_artist} - {album_title} ({year}) [{format} {bit_depth}]"
track_format = "{track_number} - {track_title_base}"
embed_cover = true
save_cover = true
no_keyring = false
no_database = false
lyrics = false
lyrics_sources = ["qobuz", "lrclib"]
lyrics_save_lrc = false
lyrics_synced_only = false
lyrics_overwrite = false
replaygain = true
[spotify]
client_id = ""
redirect_uri = "http://127.0.0.1/callback"
market = ""
Environment overrides: MUSEATER_CONFIG, MUSEATER_OUTPUT_DIR,
MUSEATER_QOBUZ_TOKEN, MUSEATER_DATA_DIR, MUSEATER_CACHE_DIR.
ReplayGain
Qobuz returns per-track audio_info.replaygain_track_gain and
replaygain_track_peak. museater writes them as
REPLAYGAIN_TRACK_GAIN/REPLAYGAIN_TRACK_PEAK tags in FLAC and as
TXXX frames in MP3. Players such as Roon, Plexamp, Navidrome, and many DAPs
use these tags to normalize playback volume without re-encoding or changing
the audio. The values are advisory metadata only; the FLAC/MP3 stream is
untouched. Disable with --no-replaygain or replaygain = false.
Development
uv sync --extra dev
uv run --extra dev pytest
uv run --extra dev ruff check .
Live tests are gated by MUSEATER_TEST_TOKEN; the default suite never touches
the network. uv.lock is committed for reproducible environments.
License
GPL-3.0-only. See LICENSE and THIRD_PARTY_NOTICES.md.