Python SSE client for Azuracast
Project description
azuracast-sse-client
An SSE-driven Azuracast metadata client
Why this app
This client connects to an Azuracast SSE client and captures the high-frequency metadata updates from the Azuracast server. You supply a callback that will be given the current metadata. The client runs continuously until stopped.
Configuration
client = build_sse_client(servername, shortcode, downtimeDJName)
client.run(callback)
servername: the target Azuracast server name as a string.shortcode: the radio station ID, from the station's profile page on the Azuracast server.downtimeDJName: if you play tracks automatically from the library, this "DJ" name will be supplied as the default DJ.callback: your processing code. You will receive aNowPlayingResponseobject (q.v.).
Environment variables
AZ_CLIENT_DEBUG: Set this to any non-null value to enable logging of the extracted metadata as it arrives.
NowPlayingResponse
The NowPlayingResponse object contains the parsed metadata from the current SSE event. The 0.1.x version
of this module returns the current song info and any available streamer data only. The SSE event contains
quite a lot more information, but I only needed a subset of the fields:
artist: artist name for current songtrack: track name for current songalbum: album name of current songdj: current streamer's name, or the default DJ name if Azuracast is playing from the media librarylive:Trueif there is a live streamer,Falseif notduration: length of the current track inhh:mm:ssformatelapsed: how long the track has been playingstart:datetimethat the track started playingartURL: a URL pointing to the track artwork, or a generic cover image supplied by Azuracast if no track artwork is available
Using the client
The client works best if you are setting up a long-running monitor to watch the SSE data and update
a display (e.g., sending the data to a Discord channel). It can be run in bursts to fetch the current data,
but the AzuracastPy library is a better fit for one-off requests.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file azuracast_sse_client-0.1.0.tar.gz.
File metadata
- Download URL: azuracast_sse_client-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8489ffa09c1185bf2ef5a3973819a5c4d31bf4b7fd159d17e847776187dcc666
|
|
| MD5 |
2cf8611918b416f1201aa7cc8760a996
|
|
| BLAKE2b-256 |
19636e93052ef98d85bab1e41104ef8149a3c159f7c98157d855aa53196594a6
|
File details
Details for the file azuracast_sse_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: azuracast_sse_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae15a8c522fb8cf9db4360804fe8205f7b806dddb4281060742dfa1bc23ae995
|
|
| MD5 |
0aad5fa1237f35cf55e3c48cb36a7143
|
|
| BLAKE2b-256 |
4519a19ee4a2cd0a157c591a3036d45da9f79bc27ce73b0b40b23360b64912ed
|