Spotify TUI

A Spotify client for the terminal written in Rust.

Demo

The terminal in the demo above is using the Rigel theme.

Installation

The binary executable is spt.

Homebrew (macOS)

bash brew install Rigellute/tap/spotify-tui

To update, run

bash brew upgrade spotify-tui

Cargo (Linux)

Eventually, there should be prebuilt binaries available in the Github release, but until then you can install via Rust's package manager cargo.

First, install Rust (using the recommended rustup installation method) and then

bash cargo install spotify-tui

This method will build the binary from source, so has the benefit of supporting more architectures.

I've only tested on Ubuntu and Debian, but I expect this to work on other Linux distros.

To update, run

bash cargo update spotify-tui

Manual

  1. Download the latest binary (currently only for macOS).
  2. cd to the file you just downloaded and unzip
  3. cd to spotify-ui and run with ./spt

Connecting to Spotify’s API

spotify-tui needs to connect to Spotify’s API in order to find music by name, play tracks etc.

Instructions on how to set this up will be shown when you first run the app.

But here they are again:

  1. Go to the Spotify dashboard
  2. Click Create a Client ID and create an app
  3. Now click Edit Settings
  4. Add http://localhost:8888/callback to the Redirect URIs
  5. You are now ready to authenticate with Spotify!
  6. Go back to the terminal
  7. Run spt
  8. Enter your Client ID
  9. Enter your Client Secret
  10. You will be redirected to an official Spotify webpage to ask you for permissions.
  11. After accepting the permissions, you'll be redirected to localhost (blank webpage, might say something like "Connection Refused" since no server is running), copy the URL and paste into the prompt in the terminal.

And now you are ready to use the spotify-tui 🎉

You can edit the config at anytime at ${HOME}/.config/spotify-tui/client.yml.

Usage

The binary is named spt.

When running spotify-tui press ? to bring up a help menu that shows currently implemented key events and their actions.

Limitations

This app uses the Web API from Spotify, which doesn't handle streaming itself. So you'll need either an official Spotify client open or a lighter weight alternative such as spotifyd.

If you want to play tracks, Spotify requires that you have a Premium account.

Using with spotifyd

Follow the spotifyd documentation to get set up.

After that there is not much to it.

  1. Start running the spotifyd daemon.
  2. Start up spt
  3. Press d to go to the device selection menu and the spotifyd "device" should be there - if not check these docs

Libraries used

Development

  1. Install OpenSSL
  2. Install Rust
  3. Clone or fork this repo and cd to it
  4. And then cargo run

Roadmap

The goal is to eventually implement almost every Spotify feature.

High level requirements yet to be implemented

This table shows all that is possible with the Spotify API, what is implemented already, and whether that is essential.

| API method | Implemented yet? | Explanation | Essential? | | ------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | | track | No | returns a single track given the track's ID, URI or URL | No | | tracks | No | returns a list of tracks given a list of track IDs, URIs, or URLs | No | | artist | No | returns a single artist given the artist's ID, URI or URL | Yes | | artists | No | returns a list of artists given the artist IDs, URIs, or URLs | No | Get Spotify catalog information about an artist's albums | Yes | | artistalbums | Yes | Get Spotify catalog information about an artist's top 10 tracks by country. | Yes | | artisttoptracks | No | Get Spotify catalog information about artists similar to an | Yes | | artistrelatedartists | No | Get Spotify catalog information about artists similar to an identified artist. Similarity is based on analysis of the Spotify community's listening history. | Yes | | album | Yes | returns a single album given the album's ID, URIs or URL | Yes | | albums | No | returns a list of albums given the album IDs, URIs, or URLs | No | | searchalbum | Yes | Search album based on query | Yes | | searchartist | Yes | Search artist based on query | Yes | | searchtrack | Yes | Search track based on query | Yes | | searchplaylist | Yes | Search playlist based on query | Yes | | albumtrack | Yes | Get Spotify catalog information about an album's tracks | Yes | | user | No | Gets basic profile information about a Spotify User | No | | playlist | Yes | playlist | Yes | | currentuserplaylists | Yes | Get current user playlists without required getting his profile | Yes | | userplaylists | No | Gets playlists of a user | No | | userplaylist | No | Gets playlist of a user | No | | userplaylisttracks | Yes | Get full details of the tracks of a playlist owned by a user Yes | | userplaylistcreate | No | Creates a playlist for a user | Yes | | userplaylistchangedetail | No | Changes a playlist's name and/or public/private state | Yes | | userplaylistunfollow | No | Unfollows (deletes) a playlist for a user | Yes | | userplaylistaddtrack | No | Adds tracks to a playlist | Yes | | userplaylistreplacetrack | No | Replace all tracks in a playlist | No | | userplaylistrecordertracks | No | Reorder tracks in a playlist | No | | userplaylistremovealloccurrencesoftrack | No | Removes all occurrences of the given tracks from the given playlist | No | | userplaylistremovespecificoccurrenesoftrack | No | Removes all occurrences of the given tracks from the given playlist | No | | userplaylistfollowplaylist | No | Add the current authenticated user as a follower of a playlist. | Yes | | userplaylistcheckfollow | No | Check to see if the given users are following the given playlist | Yes | | me | No | Get detailed profile information about the current user. | Yes | | currentuser | No | Alias for me | Yes | | currentuserplayingtrack | Yes | Get information about the current users currently playing track. | Yes | | currentusersavedalbums | No | Gets a list of the albums saved in the current authorized user's "Your Music" library | Yes | | currentusersavedtracks | Yes | Gets the user's saved tracks or "Liked Songs" | | currentuserfollowedartists | No | Gets a list of the artists followed by the current authorized user | Yes | | currentusersavedtracksdelete | No | Remove one or more tracks from the current user's "Your Music" library. | Yes | | currentusersavedtrackscontain | No | Check if one or more tracks is already saved in the current Spotify user’s “Your Music” library. | Yes | | currentusersavedtracksadd | No | Save one or more tracks to the current user's "Your Music" library. | Yes | | currentusertopartists | No | Get the current user's top artists | Yes | | currentusertoptracks | No | Get the current user's top tracks | Yes | | currentuserrecentlyplayed | No | Get the current user's recently played tracks | Yes | | currentusersavedalbumsadd | No | Add one or more albums to the current user's "Your Music" library. | Yes | | currentusersavedalbumsdelete | No | Remove one or more albums from the current user's "Your Music" library. | Yes | | userfollowartists | No | Follow one or more artists | Yes | | userunfollowartists | No | Unfollow one or more artists | Yes | | userfollowusers | No | Follow one or more users | No | | userunfollowusers | No | Unfollow one or more users | No | | featuredplaylists | No | Get a list of Spotify featured playlists | Yes | | newreleases | No | Get a list of new album releases featured in Spotify | Yes | | categories | No | Get a list of new album releases featured in Spotify | Yes | | recommendations | No | Get Recommendations Based on Seeds | Yes | | audiofeatures | No | Get audio features for a track | No | | audiosfeature | No | Get Audio Features for Several Tracks | No | | audioanalysis | No | Get Audio Analysis for a Track | No | | device | Yes | Get a User’s Available Devices | Yes | | currentplayback | Yes | Get Information About The User’s Current Playback | Yes | | currentplaying | No | Get the User’s Currently Playing Track | No | | transferplayback | No | Transfer a User’s Playback | No | | startplayback | Yes | Start/Resume a User’s Playback | Yes | | pauseplayback | Yes | Pause a User’s Playback | Yes | | nexttrack | Yes | Skip User’s Playback To Next Track | Yes | | previoustrack | Yes | Skip User’s Playback To Previous Track | Yes | | seek_track | No | Seek To Position In Currently Playing Track | Yes | | repeat | Yes | Set Repeat Mode On User’s Playback | Yes | | volume | No | Set Volume For User’s Playback | No | | shuffle | Yes | Toggle Shuffle For User’s Playback | Yes |