Control Spotify playback on any device through the command line.
Project description
Spotify CLI 🎧
Control Spotify playback on any device through the command line.
Installation
This package only supports Python 3 and above.
pip3 install spotify-cli
Usage
This CLI performs all interactions through the Spotify API. All you need is a stable internet connection and an active Spotify session on any device.
Authorize the CLI & save your credentials locally.
spotify auth login
Start Spotify playback on any device and run the spotify
command.
$ spotify
Usage: spotify [<options>] <command>
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
auth Manage user authentication for spotify-cli.
devices Manage active devices.
next Play the next song in the queue.
pause Pause playback.
play Resume playback.
previous Play the previous song in the queue.
repeat Turn repeat on (all/track) or off.
save Save the current track, album, artist, or playlist.
shuffle Turn shuffle on or off.
status Describe the current playback session.
volume Control the active device's volume level.
Examples
Describe and control current playback.
$ spotify play
Playing: Nights
Frank Ocean - Blonde
$ spotify status -vv
Song Nights (03:31 / 05:07)
Artist Frank Ocean
Album Blonde
Status Playing (on repeat, 60% volume)
Device Lorenzo (Smartphone)
URL: https://open.spotify.com/track/7eqoqGkKwgOaWNNHx90uEZ
$ spotify vol --up 20
Volume set to 80%
$ spotify vol --to 100
Volume set to 100%
You can also manage multiple devices.
$ spotify devices -v
LENOVO - Computer
* Lorenzo - Smartphone
Web Player (Chrome) - Computer
$ spotify devices --switch comp
2 devices matched "comp".
? Please select the device to activate.
> LENOVO - Computer
Web Player (Chrome) - Computer
Switched to LENOVO - Computer
Command shortcut prefixes are supported.
# supported
spotify volume
spotify vol
spotify v
spotify next
spotify n
spotify previous
spotify prev
# not supported - too many matches (pause, play, previous)
spotify p
Some commands support the --raw
flag to output the Spotify API JSON response (shell script-friendly).
$ spotify status --raw | jq --jsonargs .context
{
"external_urls": {
"spotify": "https://open.spotify.com/album/3mH6qwIy9crq0I9YQbOuDf"
},
"href": "https://api.spotify.com/v1/albums/3mH6qwIy9crq0I9YQbOuDf",
"type": "album",
"uri": "spotify:album:3mH6qwIy9crq0I9YQbOuDf"
}
Notes
- Playback and device-related commands require at least one active Spotify session on any device.
- You can just start and stop playback to "activate" your device.
- Your device will remain "active" even when paused.
- Some operations may not be supported on certain devices (i.e. volume control for mobile) and for users not subscribed to Spotify Premium.
- In development: search, browse, more playback options, custom auth scopes.
License
The MIT License (MIT)
Copyright (c) 2020 Benj Ledesma
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spotify-cli-0.2.0.tar.gz
.
File metadata
- Download URL: spotify-cli-0.2.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0771a7bb8e2872a19db58e4a6f9c7dd1c4ab63a909d02cf774c465b4c79af00 |
|
MD5 | 5b33e8d71f911a3138082143d703634f |
|
BLAKE2b-256 | 36f89e0a5175b9cef355eb4e46e1960982d5df3d7627a962ea04e86643e3b986 |
File details
Details for the file spotify_cli-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: spotify_cli-0.2.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed5d151df920ff41d045c8fc79d5cf6881049726ed6753d125f0a3af80d960e8 |
|
MD5 | 13dc6fb4de4b6be4cecb0b0b6415f3a2 |
|
BLAKE2b-256 | 03722fcbb2dde52f9128895d97fd3c0671d6e910a3329ba72c2f4083f1bdc502 |