Simple client library to submit listens to the ListenBrainz server
Project description
Python module to submit listens to the ListenBrainz service
Simple python module to submit listens to the ListenBrainz server.
Supports submitting single listens, now playing notifications and import of multiple listens. Automatically honors the ListenBrainz server's rate limits.
Usage
import time
from listenbrainz_submit import ListenBrainzClient, Track
# The user's personal ListenBrainz token obtained from https://listenbrainz.org/profile/
user_token = "..."
client = ListenBrainzClient(user_token=user_token)
# Prepare a track to submit
track = Track(
artist_name="Dool",
track_name="Vantablack",
release_name="Here Now, There Then",
additional_info={
"listening_from": "My great music player",
"recording_mbid": "e225fb84-dc9a-419e-adcd-9890f59ec432",
"release_mbid": "aa1ea1ac-7ec4-4542-a494-105afbfe547d",
"artist_mbids": "24412926-c7bd-48e8-afad-8a285b42e131",
"tracknumber": 1,
}
)
# Inform ListenBrainz that this track is playing right now. ListenBrainz
# will display this track on the user's listens page as being currently played.
client.playing_now(track)
To actually submit a track as has been listened to call:
# Submit the listen with a current timestamp
client.listen(int(time.time()), track)
For details on the API usage please refer to the ListenBrainz API documentation, especially the Payload JSON details which describes the metadata that can be submitted.
License
listenbrainz-submit © 2018-2022 Philipp Wolfer ph.wolfer@gmail.com
Published under the MIT license, see LICENSE for details.
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 listenbrainz_submit-1.0.tar.gz
.
File metadata
- Download URL: listenbrainz_submit-1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2406fd7e479d241b0f1fa2739bedf96f8057eca0d733d0816b850d78cd175c21 |
|
MD5 | 7148c57b82ed12f2747e44bb1294c912 |
|
BLAKE2b-256 | 2b78daa8516698d80cbc709d44b3017229ad2db6f9b82f642970be39e4377a8d |
File details
Details for the file listenbrainz_submit-1.0-py3-none-any.whl
.
File metadata
- Download URL: listenbrainz_submit-1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccabfe0ac64f6b07b4e28af9f75255f4972834493e5f58836a1909d4d2024de0 |
|
MD5 | ba4a8715e16b538c6d38ac0ed9ba0e9d |
|
BLAKE2b-256 | 86375e06e41097ba8fdb0c0dc10054b65a4f829500663181412530fd9a2bf168 |