Skip to main content

Spotify-Local: A multi-platform API to control the local Spotify Client

https://img.shields.io/pypi/v/requests-xml.svg?maxAge=2592000 https://img.shields.io/pypi/l/requests-xml.svg?maxAge=2592000

Spotify-Local library is designed to make controlling the Spotify client on your local machine possible! This is a wrapper for the web helper process which exposes a simple api. Spotify-Local is inspired by SpotifyAPI-NET. This library allows you to perform simple actions quickly, or listen to events and register callbacks when a song changes, or the pause button is pushed.

When using this library you automatically get:

  • The ability to play/pause the current song

  • The ability to change tracks

  • You can register callbacks and listen for events when the state of Spotify changes

  • A nice context manager api using with

Installation

$ pipenv install spotify-local

Only Python 3.3+ is supported.

Tutorial & Usage

Connect to the Spotify Client (Spotify must be open to do this):

>>> from spotify_local import SpotifyLocal

>>> with SpotifyLocal() as s:
        pass

Pause the Spotify Client:

>>> with SpotifyLocal() as s:
        s.pause()

Grab the current state of the Spotify client, including now playing information:

>>> with SpotifyLocal() as s:
        print(s.get_current_status())

Play a playlist, song, album, artist, etc using a Spotify uri link:

>>> with SpotifyLocal() as s:
        s.playURI('spotify:track:0thLhIqWsqqycEqFONOyhu')

Register a callback and listen for events:

>>> from spotify_local import SpotifyLocal
>>> s = SpotifyLocal()
>>> @s.on('track_change')
>>> def test(event):
...     print(event)
>>> s.listen(blocking=False)
>>> print("Do more stuff because that runs in the background")

License

MIT

TODO

  • Create an async verion of the spotify controller class

Metadata

Release files for spotify-local 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotify-local 0.3.2
File Size Uploaded
spotify-local-0.3.2.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotify-local 0.3.2
File Interpreter ABI Platform
spotify_local-0.3.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.9 kB

Release files / spotify-local-0.3.2.tar.gz

Download URL spotify-local-0.3.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
39e92cd94ad35160f060e9addc68d553410b1872df4b0c9065910baa8548dd73
BLAKE2b-256 checksum
How to use checksums
9dd372b37845908121d782439ea2e105d8e988a1a359d165d32b530876fec113
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / spotify_local-0.3.2-py2.py3-none-any.whl

Download URL spotify_local-0.3.2-py2.py3-none-any.whl
Size 5.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
480a2b552aced591723cd524247b76ac5b18380ea485c5ecf5baa29caac95383
BLAKE2b-256 checksum
How to use checksums
a104ee013f4b249e155eeab0bd2d6323f3b5c7da23093997f18ad5b107c7acf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page