Skip to main content

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 a NowPlayingResponse object (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 song
  • track: track name for current song
  • album: album name of current song
  • dj: current streamer's name, or the default DJ name if Azuracast is playing from the media library
  • live: True if there is a live streamer, False if not
  • duration: length of the current track in hh:mm:ss format
  • elapsed: how long the track has been playing
  • start: datetime that the track started playing
  • artURL: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azuracast_sse_client-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azuracast_sse_client-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

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

Hashes for azuracast_sse_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8489ffa09c1185bf2ef5a3973819a5c4d31bf4b7fd159d17e847776187dcc666
MD5 2cf8611918b416f1201aa7cc8760a996
BLAKE2b-256 19636e93052ef98d85bab1e41104ef8149a3c159f7c98157d855aa53196594a6

See more details on using hashes here.

File details

Details for the file azuracast_sse_client-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for azuracast_sse_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae15a8c522fb8cf9db4360804fe8205f7b806dddb4281060742dfa1bc23ae995
MD5 0aad5fa1237f35cf55e3c48cb36a7143
BLAKE2b-256 4519a19ee4a2cd0a157c591a3036d45da9f79bc27ce73b0b40b23360b64912ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page