Spotify in the terminal
I set up Spotify in the terminal, following this blog post. This documents my (MacOS) setup.
Warning! I noticed that tracks played in this way don't show up in Recently Played on Spotify (in the official client, in Spotify TUI, or via the API), so I worried that artists whose music I played weren't getting paid for it. When I played from the Spotify official client, but connected to Spotifyd as a device via Spotify Connect, then tracks did show up. So I abandoned Spotify TUI (for playing track at least, it's still useful for other bits and pieces), and am now playing to Spotifyd only via the official client(s).
spotifyd client can be installed by Homebrew:
It needs a config file with (at least) credentials:
I pasted the contents from https://docs.spotifyd.rs/config/File.html then edited accordingly: as a minimum my username and password for Spotify (more specifically, a command that yields the password so it isn't stored in plain text). A MacOS value is recommended for several of the settings, which I used, and the rest I commented out, since sensible defaults are used. Naming the device is useful so it can easily be found later:
Then start the client:
You can start it as a background service so it will restart at login with:
Once the service is running, it can be used as a client via Spotify Connect; e.g. from an official Spotify client on the same network
(I haven't bothered to change the name from the placeholder value yet!)
Setting up Spotify TUI
The text user interface to Spotify is installed with:
The app needs to be registered on the
Spotify Dashboard to get a Client
ID and Secret for using the API. On first executing Spotify TUI (by running
spt), enter these and the default port number (8888), authorise via the web
page that comes up, and you're away.
To set the device, run
spt and press the
d shortcut key to see the list of
Spotify Connect devices available
As well as running
spt interactively you can play music via options, e.g.
etc. Check the docs for examples: https://github.com/Rigellute/spotify-tui#usage