low resource spotify listening on the terminal
October 15, 2023•372 words
why:
- spotify desktop application is not easy to install on platforms that don't support deb packages
- spotify desktop is pretty resource intensive, and also a bit overstimulating for me
- even a browser tab open on spotify is a lot if you use a device with 4GB RAM
- sorry i pay for spotify
prerequisites:
- spotify premium
- unix-like system: everything here should work on linux or mac; it may also work on other platforms if you build using cargo
how:
- we can use spotify-tui to browse and control a spotify device.
- so you can also use it to control a co-existing desktop, web, mobile, and other devices. it's a nice not overstimulating way to control spotify playback on whatever device.
- we can use spotifyd unix daemon as a lightweight spotify device.
- because spotify-tui is only a UI that controls a given device. spotifyd can playback music, but does not give us a UI.
steps:
- install both spotifyd and spotify-tui from your package manager, or build using cargo. links with more details are included in the next section.
- configure spotifyd and run it. note what your device name is set to for the next step.
- run spotify-tui and complete first-time setup. a developer API key will be needed, anyone with premium can get one, the documentation will walk you through it
- with spotify-tui configured and running, press 'd' to see devices. you should be able to see your spotifyd device and select it. Now you can search or browse for music and it should play on your device.
resources:
- spotifyd
- docs with installation and configuration instructions: https://docs.spotifyd.rs/Introduction.html
- source code: https://github.com/Spotifyd/spotifyd
- spotify-tui
- source code, installation, and configuration instructions: https://github.com/Rigellute/spotify-tui
extras:
- you can run spotifyd as a systemd service. I added this spotifyd.service to my
/etc/systemd/user
folder. in my case I changedExecStart
to point to my cargo spotifyd binary location, because I built using cargo- on my other laptop i definitely do just grep my terminal history and run the command when i need it lol
- it's fun to pair it with some terminal music visualizers, like cava