A Spotify player in the terminal with full feature parity
A Spotify player in the terminal with full feature parity
spotify_player is a fast, easy to use, and configurable terminal music player.
Features
A demo of spotify_player v0.5.0-pre-release on youtube or on asciicast:
Checkout examples/README.md for more examples.
By default, the application's installed binary is spotify_player.
A Spotify Premium account is required.
openssl, alsa-lib (streaming feature), libdbus (media-control feature).For example, on Debian based systems, run the below command to install application's dependencies:
sudo apt install libssl-dev libasound2-dev libdbus-1-devOn RHEL/Fedora based systems, run the below command to install application's dependencies :
sudo dnf install openssl-devel alsa-lib-devel dbus-develor if you're using yum:
sudo yum install openssl-devel alsa-lib-devel dbus-develApplication's prebuilt binaries can be found in the Releases Page.
Note: to run the application, Linux systems need to install additional dependencies as specified in the Dependencies section.
Run brew install spotify_player to install the application.
Run scoop install spotify-player to install the application.
Install via Cargo:
cargo install spotify_player --lockedInstall via Arch Linux:
pacman -S spotify-playerNote: Defaults to PulseAudio/Pipewire. For a different backend, modify the official PKGBUILD and rebuild manually. See Audio Backends.
Install via Void Linux:
xbps-install -S spotify-playerInstall via FreeBSD:
pkg install spotify-playerInstall via NetBSD:
pkgin install spotify-playerBuild from source on NetBSD:
cd /usr/pkgsrc/audio/spotify-player
make installspotify-player is available as a Nix package. Install via:
nix-shell -p spotify-playerTo build from source locally, run nix-shell in the root of the source checkout. The provided shell.nix will install prerequisites.
Note: The streaming feature is disabled in the Docker image.
Download the latest Docker image:
docker pull aome510/spotify_player:latestRun the Docker container:
docker run --rm -it aome510/spotify_player:latestTo use your local config and cache folders:
docker run --rm \
-v $APP_CONFIG_FOLDER:/app/config/ \
-v $APP_CACHE_FOLDER:/app/cache/ \
-it aome510/spotify_player:latestspotify_player requires a Spotify Premium account and authenticates against the Spotify Web API using the OAuth 2.0 authorization code flow with PKCE. No client secret is stored or required.
The simplest way to authenticate is to just run the application — on first use it prompts for whichever credentials are not yet cached. Each prompt opens the Spotify authorization page in your browser; after you approve access, Spotify redirects to a local loopback address (login_redirect_uri, default http://127.0.0.1:8989/login) where spotify_player captures the authorization code and exchanges it for an access token. Credentials are cached in the application's cache folder, so this is a one-time step per machine.
Alternatively, run the spotify_player authenticate CLI command to authenticate all required credentials up front — useful for setting things up ahead of a daemon or headless launch. Unlike a normal launch, authenticate always forces fresh interactive logins, ignoring cached credentials, so it can also be used to re-authenticate from scratch.
Two kinds of credentials are involved:
client_id is configured, its token is used first and a separate ncspot token provides fallback access.They authenticate through your Spotify account; the client ID presented to Spotify differs between credentials (see below).
With the streaming feature enabled (the default), the first launch normally opens the Spotify authorization page twice, in this order:
client_id (ncspot's by default). This is cached as <client_id>_token.json.credentials.json.These are two independent OAuth flows with two different client IDs, so Spotify requires a separate approval for each, and each credential is cached separately in the cache folder. This is a one-time step per machine — subsequent launches reuse and silently refresh them unless a cache is cleared or a credential is revoked.
When a custom client_id is configured, an ncspot fallback Web API token is also requested and cached as <ncspot_client_id>_token.json. Its OAuth callback always uses http://127.0.0.1:8989/login; login_redirect_uri applies only to the custom client. A custom setup with streaming enabled can therefore require three approvals on first launch. Web API token cache filenames include their client IDs, so changing client_id requires a new approval instead of reusing a token issued to another client.
A fallback ncspot client is integrated since the custom client might not be registered with extended quota mode and could therefore doesn't have access to certain endpoints.
The spotify_player authenticate command runs every required flow in one go, forcing a fresh login for each. Without streaming, the librespot flow is omitted, leaving one Web API approval for the default setup or two for a custom-client setup.
Every request to the Spotify Web API is attributed to a Spotify application, identified by a client ID. The client ID — not your account — determines the API quota you are subject to.
By default, spotify_player uses ncspot's client ID. This client ID is shared by many users, so its API quota can be exhausted by aggregate usage and cause 429 Too Many Requests responses. Registering and configuring your own client ID is strongly recommended so routine requests use a quota dedicated to your Spotify application.
The ncspot client ID remains available as a fallback because it is registered in extended quota mode and predates Spotify's November 2024 Web API changes. It can access endpoints (browse, personalized content, generated playlists, …) that newly-registered applications can no longer use.
When a custom client_id is configured, spotify-player sends most Web API requests through that client first. If Spotify rejects custom-client request with any 4xx response, the request is attempted once through ncspot. Successful requests and failures outside the 4xx range do not trigger fallback.
The custom client uses no request middleware. The ncspot client stores Retry-After durations and retries rate-limited GET requests up to two times by default; mutation requests are never delayed or retried by the middleware. Configure the ncspot retry count with api_rate_limit_retries; see the configuration documentation for details.
Use a custom client ID to avoid competing for the shared ncspot client's rate limit. Most requests will be attributed to your own Spotify application instead. Newly registered applications use restricted default quota mode, so endpoints unavailable to the custom client transparently fall back to ncspot.
To configure one, register an application on the Spotify developer dashboard, add your login_redirect_uri (default http://127.0.0.1:8989/login) to the app's allowed redirect URIs, then set client_id (or client_id_command) in app.toml. See the Client id command section of the configuration docs for details.
After changing the client ID, re-run spotify_player authenticate to refresh the custom and fallback tokens.
Control Spotify remotely with Spotify Connect. Press D to list devices, then enter to connect.
Stream music directly from the terminal. The streaming feature is enabled by default and uses the rodio-backend audio backend unless otherwise specified.
The app uses librespot to create an integrated Spotify client, registering a spotify-player device accessible via Spotify Connect.
Default audio backend is rodio. Available backends:
Playback commands can repeatedly hit 429 during Retry-After cooldown
New Image-heavy page for playlists
Searching with more than 3 letters returns nothing
add database support to cache context data such as playlist/artist
Feature Request: Add man page support to help AI tools and users discover commands/key bindings
playback crashes with ALSA function 'snd_pcm_poll_descriptors' failed with error 'Unknown errno (-32)'
Add images in artists window
Audio visualizer appears ahead of playback when using Bluetooth audio
Audio playback does not route to output correctly on Windows (Windows Terminal)
Edit Queue