Running Spotify In Your Terminal
Context:
I have been a long time user of Spotify-tui but unfortunately looks like it has been abondoned for Homebrew.
The issue is described here.
But looks like all hope is not lost, there is an alternative to listen to spotify while you are in your terminal.
https://github.com/aome510/spotify-player
spotify_player
is written in Rust and is built on top of awesome libraries such as tui-rs
, rspotify
, librespot
, and many more.
But please be aware although it looks like a free Spotify account does work, it’s buggy and stops working after sometime. You will require a Premium Account!
Installation:
If you are on Mac just run the following to install:
brew install spotify_player
spotify_player
supports streaming, which needs to be built/installed with streaming feature (enabled by default) and with an audio backend (rodio-backend
by default). The streaming feature allows to spotify_player
to play music directly from terminal.
Audio backend
spotify_player
uses rodio as the default audio backend. List of available audio backends:
alsa-backend
pulseaudio-backend
rodio-backend
portaudio-backend
jackaudio-backend
rodiojack-backend
sdl-backend
gstreamer-backend
Use your homebrew to install any of the backends.
Configuration
Now for the terminal app to work properly you need to register your app with spotify and supply it with a client_id
that has basically premium support.
Create an app by going here: https://developer.spotify.com/dashboard
If you are unsure how to create an app, check out: https://developer.spotify.com/documentation/web-api/concepts/apps
Quick note: I tend to use
<http://localhost:3000/>
as my re-direct URI while creating the app!
Once your app is created you can go anytime to your App → Settings and copy the client_id
In your terminal the configuration file for spotify-player
is located at
$HOME/.config/spotify-player/app.toml
Edit the .toml
file and replace the default client_id
with your app’s client_id
Feel free to replace anything else that you want to, like bitrate etc.
If you prefer not to include your own client_id
directly in your configuration, you can retrieve it at runtime using the:
client_id_command
If specified, client_id_command
should be an object with two fields command and args, just like player_event_hook_command. For example to read your client_id from a file your could use
client_id_command = { command = "cat", args = ["/path/to/file"] }
Commands
To go to the shortcut help page, press ? or C-h (default shortcuts for OpenCommandHelp command).
List of supported commands: