stream: scrobble listened tracks to ListenBrainz
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
The web player decides when a track counts as listened (caught near its start and heard to ~90%, capped at 4 min) and triggers POST /scrobble. The token stays server-side (RADIEO_LISTENBRAINZ_TOKEN), submitting the listen with the canonical MusicBrainz MBID when available. Each airing is deduplicated so multiple tabs submit it once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
b04e717f40
commit
d302cf1c88
7 changed files with 163 additions and 2 deletions
|
|
@ -197,10 +197,15 @@ radio = mksafe(radio)
|
|||
now_playing = ref([])
|
||||
history = ref([])
|
||||
history_max = 25
|
||||
# Vrai une fois que le passage courant a été scrobblé vers ListenBrainz, pour ne
|
||||
# pas l'envoyer plusieurs fois (plusieurs onglets/auditeurs déclenchent /scrobble
|
||||
# pour la même diffusion). Remis à false à chaque nouveau titre. Voir web.liq.
|
||||
scrobbled = ref(false)
|
||||
radio.on_metadata(
|
||||
synchronous=false,
|
||||
fun(m) -> begin
|
||||
now_playing := m
|
||||
scrobbled := false
|
||||
# `file` : nom de base du fichier à l'antenne, servant de jeton de
|
||||
# téléchargement (/download?file=…). Vide si la métadonnée manque.
|
||||
entry = {title=m["title"], artist=m["artist"], url=m["url"], origin=m["origin"], file=path.basename(m["filename"])}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue