Skip to main content

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.
  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

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).
  • Behavior may differ 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spotify-cli-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

spotify_cli-0.1.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file spotify-cli-0.1.0.tar.gz.

File metadata

  • Download URL: spotify-cli-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for spotify-cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2cd9cd7bffd0104d3f00e7b24e28952e63459f5388f95a26d635fb554d413d40
MD5 d50009d695b83d04645efd5b1aaf9273
BLAKE2b-256 7883dcc06f139105232d52ca1152f151dfe753390721902fbb7272f9bf2b2000

See more details on using hashes here.

File details

Details for the file spotify_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: spotify_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for spotify_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bdb5cb6ff9e3e005a0f2bc126f508f4bf4bb61ef5023701fb918637ca22c4332
MD5 0dca7c9480293d94f206715eda863aa8
BLAKE2b-256 da600762d4053dcabbf65b0966bcd927a677e210b16bd82b5985aefb3723b159

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page