Skip to main content

Communicate with the Spotify's web helper process to control some basic aspects of spotify

Project description

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

Spotify-Local-Control 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-Control 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-control

Only Python 3.6 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
>>> def test(new_status):
...     print(new_status)
>>> s = SpotifyLocal()
>>> s.connect()
>>> s.on_status_change += test
>>> s.listen_for_events()
>>> print("Do more stuff because that runs in the background")

License

MIT

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-local-control-0.2.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

spotify_local_control-0.2.3-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file spotify-local-control-0.2.3.tar.gz.

File metadata

File hashes

Hashes for spotify-local-control-0.2.3.tar.gz
Algorithm Hash digest
SHA256 a9ab38d92c8da8c0c1d4437ae9ffae33ee64538baa575bff04ab0de31bdf03dc
MD5 bfa411d043f2872302db3cdd8bcd4a09
BLAKE2b-256 15b8e8b27fcef47c15ed3a7102a6f321f32fe8f5cdeb83990444ca86ac13cea7

See more details on using hashes here.

File details

Details for the file spotify_local_control-0.2.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for spotify_local_control-0.2.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 96d37adf728ec7568e86ba5a4b081ca127218d87b40385b02ed38d83e737783a
MD5 97ba6fbf5922e9c9b055283cd3aadde6
BLAKE2b-256 d156b4fb6775103bb98ec4622a4169588bc25c078b56c221b766c29e04aa3633

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