dubeyKartikay/lazyspotify
Über uns
Spotify-Client für das Terminal unter macOS und Linux
EntwicklerwerkzeugeGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +3
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Original
Requirements
- A Spotify Premium account.
- A working system keyring, or one of the headless token stores described in Headless and non-keyring setups.
- The patched
lazyspotify-librespotdaemon with device authorization support (only if you are installing from source or running an unpackaged build). - For macOS source or ZIP installs, install the runtime audio libraries with
brew install flac libogg libvorbis mpg123. Homebrew package installs handle these dependencies automatically. - On Linux, one of
wl-clipboard,xclip, orxselif you want clipboard support on the auth screen.
Install
Homebrew
brew tap dubeyKartikay/lazyspotify
brew install lazyspotify
Arch Linux
yay -S lazyspotify-bin
Nix
Available in Nixpkgs.
nix run nixpkgs#lazyspotify
GitHub Releases
Download the latest package from GitHub Releases.
- macOS:
.zip - Ubuntu/Debian:
.deb - Fedora:
.rpm - Arch:
.tar.gz
Example package installs:
sudo dpkg -i lazyspotify-*.deb
sudo dnf install ./lazyspotify-*.rpm
Build From Source
Build the app:
git clone https://github.com/dubeyKartikay/lazyspotify.git
cd lazyspotify
make build
Then build the patched daemon from dubeyKartikay/go-librespot and point librespot.daemon.cmd at that binary in your config.
If you build lazyspotify yourself and do not compile in a packaged daemon path, librespot.daemon.cmd is required.
Demos
Play A Track From Playlist > Track

Player Controls

Library Navigation

Search

Set Up Your Spotify Client ID
lazyspotify requires your own Spotify app client ID.
- Open the Spotify Developer Dashboard.
- Create a new app with:
- App name:
lazyspotify - App description:
terminal based spotify client - Website:
https://github.com/dubeyKartikay/lazyspotify - Redirect URIs:
http://127.0.0.1:8287/callback - APIs used:
Web API,Web Playback SDK
- App name:
- Copy the app's Client ID.
- Put the Client ID in
config.ymlor export it as an environment variable. See Configuration.
Minimal config:
auth:
client_id: your_spotify_app_client_id
Environment override:
export AUTH_CLIENT_ID=your_spotify_app_client_id
If you change auth.host, auth.port, or auth.redirect-endpoint, update the Spotify app Redirect URI to match exactly.
Logging In
Spotify deprecated the token-based login the player daemon previously used, so lazyspotify now signs you in once per browser session:
- Start
lazyspotify. On the first run you are asked to log in with your Spotify account through the browser (this uses your own client ID from the section above and powers browsing). - After you approve, the same browser page continues straight to Spotify's device pairing screen with the code already filled in. Approve the pairing to connect the player daemon.
- The daemon stores its own credentials. On later runs lazyspotify starts silently: the login token comes from your configured token store and the player reuses the daemon's stored credentials. You only see the pairing screen again if Spotify invalidated the stored credentials.
The token from your own client ID is only used for Web API requests (playlists, search, library). The player daemon authenticates itself through Spotify's device authorization flow, so it no longer depends on your client ID or token.
Logging in over SSH
- Run
lazyspotifyon the remote machine and open its login link in your local browser. - Approve the Spotify login. The browser may show a connection error when it redirects to
http://127.0.0.1:8287/callbackon your local machine. Leave that tab open. - Copy the full URL from the address bar. In lazyspotify, press p, paste that URL using your terminal's paste shortcut, and press Enter.
- If the player needs pairing, lazyspotify shows a Spotify pairing link and code. Open that link in the same browser and approve the pairing. The pairing page is hosted by Spotify and works from any machine.
Configuration
Config file locations:
- macOS:
~/Library/Application Support/lazyspotify/config.yml - Linux:
~/.config/lazyspotify/config.yml
If the file is missing, lazyspotify creates config.yml with:
auth:
client_id: your_spotify_app_client_id
Then replace your_spotify_app_client_id with your Spotify app Client ID.
Minimal config for package installs:
auth:
client_id: your_spotify_app_client_id
Minimal config for source or manual installs:
auth:
client_id: your_spotify_app_client_id
librespot:
daemon:
cmd:
- /absolute/path/to/lazyspotify-librespot
The generated daemon config is written automatically under the librespot/ subdirectory inside the app config directory. You usually do not need to edit it manually.
Auth Settings
| Key | Required | Default | Notes |
|---|---|---|---|
log_level |
No | ERROR |
App log level for lazyspotify. |
auth.client_id |
Yes | none | Your Spotify app client ID. |
auth.host |
No | 127.0.0.1 |
Host used for the local OAuth callback server. |
auth.port |
No | 8287 |
Port used for the local OAuth callback server. |
auth.redirect-endpoint |
No | /callback |
Callback path for Spotify OAuth. |
auth.timeout |
No | 30 |
Auth server shutdown timeout in seconds. |
auth.keyring.service |
No | spotify |
Keyring service name for stored tokens. |
auth.token-store.key |
No | token-v2 |
Key under which the token is stored, for every backend. |
auth.keyring.key |
No | none | Deprecated fallback, used when auth.token-store.key is empty. |
auth.token-store.backend |
No | keyring |
Where the login token is stored: keyring, file, or command. See Headless and non-keyring setups. |
auth.token-store.file.path |
No | token.json in the config directory |
Token file used by the file backend. ~ is expanded, relative paths resolve against the config directory, and the path must name a file. |
auth.token-store.command.get |
For command |
none | Argv that prints the stored token on stdout. It must exit non-zero only when no token exists yet. |
auth.token-store.command.set |
For command |
none | Argv that reads a token from stdin and stores it. |
auth.token-store.command.not-found-exit-codes |
No | any non-zero exit | Exit codes from get that mean "no token stored yet". Set this to protect real failures from being treated as a missing token. |
auth.token-store.command.timeout |
No | 10 |
Timeout in seconds for each token store command. |
Librespot Settings
| Key | Required | Default | Notes |
|---|---|---|---|
librespot.host |
No | 127.0.0.1 |
Host for the local playback API server. |
librespot.port |
No | 4040 |
Port for the local playback API server. |
librespot.timeout |
No | 180 |
Playback API timeout in seconds. |
librespot.retry-delay |
No | 100 |
Retry delay in milliseconds. |
librespot.max-retries |
No | 3 |
Retry count for daemon calls. |
librespot.seek-step-ms |
No | 5000 |
Seek step size in milliseconds. |
librespot.volume-step |
No | 20 |
Volume step percentage (0-100) used for volume controls. |
librespot.daemon.cmd |
Sometimes | none | Required for source/manual installs unless a packaged daemon path was compiled into the binary. |
librespot.daemon.log_level |
No | ERROR |
Log level written into the generated librespot daemon config. |
librespot.daemon.zeroconf_enabled |
No | false |
Enables zeroconf in the daemon config. |
Environment variables can override config values by replacing . and - with _. Examples: LOG_LEVEL, AUTH_CLIENT_ID, AUTH_TOKEN_STORE_BACKEND, LIBRESPOT_DAEMON_LOG_LEVEL.
Scalar argv values (auth.token-store.command.get, auth.token-store.command.set, librespot.daemon.cmd) are shell-split whether they come from an environment override or a YAML string, so spaces separate arguments and quotes keep them together:
export AUTH_TOKEN_STORE_COMMAND_GET='pass show lazyspotify/token'
export AUTH_TOKEN_STORE_COMMAND_SET='pass insert -m -f "lazyspotify/token"'
Quoting follows POSIX shell rules. On Windows, prefer setting these argv values in config.yml instead of the environment, because backslashes act as escapes.
Headless and non-keyring setups
The default keyring backend needs a system keyring, which on Linux means Secret Service and D-Bus. Headless setups such as WSL instances, containers, and servers often cannot provide one. Set auth.token-store.backend to keep the login token somewhere else:
keyring(default): the system keyring.file: a plaintext JSON file with0600permissions. Anyone who can read the file can read your Spotify token. A file that cannot be parsed is moved aside to<path>.corrupt-<timestamp>so the next login can rebuild it.command: an external secret manager such aspassoroo7.command.getprints the token on stdout;command.setreads the token from stdin and stores it.
Whatever the backend, a stored value that is not a usable token (null, {}, no access and no refresh token, or invalid JSON) is treated as missing, so the next login replaces it.
command.get must exit non-zero only when no token exists yet. By default any non-zero exit means "log in again"; a locked gpg-agent or a broken pass install would then trigger a login that overwrites a still-valid entry. Set not-found-exit-codes to the codes that really mean "missing" so other failures stop the app with the command's stderr instead. Signal-killed commands, output larger than the internal limit, and unlisted exit codes always surface as errors.
Plaintext file:
auth:
client_id: your_spotify_app_client_id
token-store:
backend: file
file:
path: ~/.config/lazyspotify/token.json
Password Store (pass):
auth:
client_id: your_spotify_app_client_id
token-store:
backend: command
command:
get: [pass, show, lazyspotify/token]
set: [pass, insert, -m, -f, lazyspotify/token]
# `pass show` exits 1 when the entry is absent and 2 for GPG failures.
not-found-exit-codes: [1]
The get command is expected to fail when no token exists yet, so the first run still shows the login screen. The configured token key (auth.token-store.key) is exported to both commands as LAZYSPOTIFY_TOKEN_KEY. Changing backends does not migrate existing tokens, so you log in once more after switching.
Run
Start the app with:
lazyspotify
If you built from source:
./target/lazyspotify
Print build metadata:
lazyspotify version
Development
make run
go test ./...
Community
Ähnliche Projekte entdecken
Wird geladen…