Skip to main content

a command line interface to Spotify on Linux

Project description

spotify-cli-linux

Build Version Python versions

A command line interface to Spotify on Linux.

This project is inspired by the similar project called shpotify, which does similar things, but on macOS.

installation

pip install spotify-cli-linux

hint #1: if you encounter problems during installation, try to call command with sudo

hint #2: if you still have problems (e.g. with resolving project dependencies), try to call pip3 instead of pip

if you have any problems with pip or pip3, you can try to install the script in the alternative way as a workaround:

git clone git@github.com:pwittchen/spotify-cli-linux.git
cd spotify-cli-linux
sudo cp spotifycli/spotifycli.py /usr/local/bin/spotifycli

upgrade

pip install spotify-cli-linux --upgrade

for the upgrade, you can apply the same hints like for installation

usage

start the official Spotify desktop app

run the following command from your terminal:

spotifycli

use one of the following parameters:

-h, --help        show this help message and exit
--version         shows version number
--status          shows song name and artist
--statusshort     shows status in a short way
--statusposition  shows song name and artist, with current playback position
--song            shows the song name
--songshort       shows the song name in a short way
--artist          shows artists name
--artistshort     shows artist name in a short way
--album           shows album name
--arturl          shows album image url
--lyrics          shows lyrics for the song playing
--playbackstatus  shows playback status
--position        shows song position
--play            plays the song
--pause           pauses the song
--playpause       plays or pauses the song (toggles a state)
--next            plays the next song
--prev            plays the previous song
--client CLIENT   sets client's dbus name

if you don't use any parameters, you'll enter the shell mode, where you'll be able to use all commands mentioned above

solving problems

dbus

When you've seen the following error:

No module named dbus

Then try to install python-dbus! On Ubuntu you can do it as follows:

sudo apt-get install python-dbus

If you are using another distro, then try to install python-dbus with your package manager.

lyricwikia

When, you're missing lyricwikia dependency, run the following command:

pip install lyricwikia

usage with tmux

If you want to use this script in your tmux panel, you can check tmux-plugin-spotify.

development

to install necessary tools for code formatting, static code analysis and releasing, run:

make requirements

code formatting

Source code should be formatted according to PEP8 style guides.

To format code, run:

make format

to verify code formatting, type:

make checkformat

static code analysis

To run static code analysis, execute:

make lint

docs

to update docs on gh-pages, type:

make docs

to run docs locally, type:

git checkout gh-pages && ./serve.sh

and view page with docs at: 0.0.0.0:8000

view it on-line at https://pwittchen.github.io/spotify-cli-linux

releasing

currently release is automated via deploy.yml GitHub Action, but it can be done manually too

configure your ~/.pypirc file as follows:

[distutils]
index-servers =
    pypi
[pypi]
username:yourusername
password:yourpassword

then, update version in spotifycli/version.py and spotifycli/spotifycli.py and type:

make release

note: Version is not kept in a single file due to problems with importing files within another file and distributing them to PyPi. There are also Python vesion issues. If you know how to fix this issue properly to keep version in one place, I'd be happy to review your PR :-).

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-linux-1.8.2.tar.gz (17.7 kB view details)

Uploaded Source

File details

Details for the file spotify-cli-linux-1.8.2.tar.gz.

File metadata

  • Download URL: spotify-cli-linux-1.8.2.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for spotify-cli-linux-1.8.2.tar.gz
Algorithm Hash digest
SHA256 5c93248904751687883df02e253db691f60975cfc006ec44c442e1d0411ebfc9
MD5 538b201cc778ebde8ea2a5458b360a17
BLAKE2b-256 3bb0f613ded2d3dffb05ee637f8ebec0148112e6a248aff9f2bce6978034c13e

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