Python wrapper to control your Spotify client on MacOS
Project description
WASP
Wrapper around AppleScript of Spotify in Python.
This library provides a simple wrapper around the AppleScript API of the Spotify application on MacOS.
Developed and tested with Python 3.7
Install
pip install wasp-spotify-bindings
Test
python wasp/tests/test_wasp.py
python wasp/tests/test_applescript.py
Import
from wasp_spotify_bindings.core import Wasp
wasp = Wasp()
API
Get track metadata.
wasp.get_track()
returns
{
'artist': 'Rick Astley',
'album': 'Whenever You Need Somebody',
'disc_number': 1,
'duration': 213573,
'played_count': 0,
'track_number': 1,
'popularity': 75,
'id': 'spotify:track:4uLU6hMCjMI75M1A2tKUQC',
'name': 'Never Gonna Give You Up',
'album_artist':
'Rick Astley',
'artwork_url':
'http://i.scdn.co/image/15ac2c9091d9b74e841b281ceb23ca8208321444',
'spotify_url': 'spotify:track:4uLU6hMCjMI75M1A2tKUQC'
}
Get player state.
wasp.get_state()
returns
{
"track_id": "spotify:track:4uLU6hMCjMI75M1A2tKUQC",
"volume": 49,
"position": 3, # seconds
"state": "playing"
}
Start Spotify application.
wasp.start_spotify()
Quit Spotify application.
wasp.quit_spotify()
Play next track.
wasp.next_track()
Play previous track.
wasp.previous_track()
Play current track.
wasp.play()
Toggle play/pause on current track.
wasp.play_pause()
Pause current track.
wasp.pause()
Set volume to [0-100]
wasp.set_volume(volume=10)
Play track referred to by spotify id.
wasp.play_track(spotify_uri='spotify:track:4uLU6hMCjMI75M1A2tKUQC')
Play track in context of an album/playlist.
wasp.play_track_in_context(
spotify_uri='spotify:track:4uLU6hMCjMI75M1A2tKUQC',
context='spotify:track:4uLU6hMCjMI75M1A2tKUQC'
)
Increase volume by 10.
wasp.volume_up()
Decrease volume by 10.
wasp.volume_down()
Jump to position in song (seconds).
wasp.jump_to(jump_to_second=5)
Check if repeat is enabled.
wasp.is_repeating()
Check if shuffle is enabled.
wasp.is_shuffling()
Set repeating to True
or False
.
wasp.set_repeating(set_repeating=True)
Set shuffling to True
or False
.
wasp.set_shuffling(set_shuffling=True)
Toggle repeat on/off.
wasp.toggle_repeating()
Toggle shuffle on/off.
wasp.toggle_shuffling()
Mute player.
wasp.mute()
Unmute player.
wasp.unmute()
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 wasp_spotify_bindings-0.0.1.tar.gz
.
File metadata
- Download URL: wasp_spotify_bindings-0.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
93d79468cfcd9fec33f4d6263ec708e45a68a1b63afa6f7915742587c85d0ad8
|
|
MD5 |
e1249fc63edd62aba0c0cb1acfedff19
|
|
BLAKE2b-256 |
8ed60e92aa8437a577b3c063f18c0f93aa37ca53f889d99ee97f2d3d834c6e8d
|
File details
Details for the file wasp_spotify_bindings-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: wasp_spotify_bindings-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.1rc1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7eec6f208a26243049706bbb904c1b15559c110c6b0fb9630379c6575201faad
|
|
MD5 |
2b5dfef78adcef14d6395c6d346fac1c
|
|
BLAKE2b-256 |
8e2ca5b78b481ff9bac2832e7f8b0c95fe862b70612599cb0be12de90c38e44c
|