1 unstable release
0.3.0 | Aug 10, 2023 |
---|
#926 in Audio
19KB
200 lines
SpotifyCtl
A simple tool to control spotify from the command line. Based on rspotify.
Features
SpotifyCtl has few commmands:
get
: Display the currently playing track or episode.previous
: Restart the current track or skip to the previous track.next
: Skip to the next track.play-pause
: Pause or resume playback.
Installation
SpotifyCtl is written in Rust. First, one need to Install a rust toolchain. And then run:
cargo install --path .
Configuration
- One need to create a spotify app on the dedicated page.
- You will get a
Client Id
and aClient Secret
. Note them down. - Edit the settings of your app to add a
Redirect URI
. I suggest usinghttps://localhost:8888/callback
. This URI do not need to be accessible. - Add any user email that will be able to use
spotifyctl
. - Export the following environment variables with the values noted down:
export RSPOTIFY_CLIENT_ID=ef0fbc0adc633de52214e7a211a13310
export RSPOTIFY_CLIENT_SECRET=08c77cdf9a8df31ffac2cd03eff0a748
export RSPOTIFY_REDIRECT_URI=https://localhost:8888/callback
- Run
spotifyctl get
in a terminal. This should start a browser when you will to let your spotify user accept to connect to your new spotify app. - You will redirected to an invalid webpage. Note that URL and past it to the
terminal where you ran
spotifyctl get
. - This will occur only once since
spotifyctl
will store a renewable token on the disk and you will not have to authenticate using a browser again. - Run any other
spotifyctl
command whenever you want, but always with the previously defined environment variables.
Dependencies
~12–28MB
~320K SLoC