The player's "source" link only worked for direct yt-dlp URLs. Two other
cases had no linkable page: ListenBrainz picks resolved via ytsearch1: (the
locator is a search query) and Subsonic library tracks (an opaque song id).
Centralise the rule in Track.page_url and cover both: the yt-dlp fetcher now
records the concrete video URL it resolved into source_url, and a Subsonic
track links to the stream's new /share endpoint, which asks ingest to mint a
public share (createShare) on demand and redirects to it — so a share is only
created when a listener actually clicks, never per played track.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire the Media Session previous-track control to a new POST /restart-track
route that requeues the current song from the start for every listener, and
keep next-track as skip. Exposing both handlers also makes Android (Chrome)
show the skip button, which it hides when only nexttrack is set.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wire the web player into system media controls (MPRIS, Control Center,
lock screen) and keyboard media keys: push track metadata and handle
play/pause/next, with seek neutralized on the live stream.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds special jingle folders (midi, gouter, bisous) that take priority
over the default jingle rotation once per day, briefly after 11h00,
15h00, 16h30 and 21h00.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
For yt-dlp tracks the locator is the original web page, so pass it as a
url annotation, carry it through the stream metadata and history, and
turn the track title into a link back to that page (both live and in the
history). Subsonic ids are opaque and stay plain text.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Default it to "Nemu FM" and derive the tab title, logo, and dynamic
document title from one STATION_NAME constant for easy renaming.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
If the stream drops (server restart, network loss), the player now retries
goLive() on error/ended/stalled with a delay that doubles each failure, capped
at 30s, and resets once audio flows again.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
/download now accepts ?file=<name> to fetch any cached file, not just the
current track. History entries carry that filename token (via /history), so
the web UI renders each aired track as a download link. A shared
serve_attachment helper validates the request (basename-only, real audio file,
no hidden/.part files) before streaming it; LRU-evicted tracks return 404.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On the pinned savonet/liquidsoap:v2.4.5 image, `source.on_track` no longer
exists as a module function — on_track is a method on the source value. The
old `music = source.on_track(music, …)` form fails type-checking, so the whole
radio.liq is rejected and the stream container never starts. Register the
handler in place via the method form instead.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a read-only field with the bare /radio.mp3 URL and a copy button
(clipboard API, with a select+execCommand fallback), so the stream can
easily be opened in VLC or another external player.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Firefox kept resuming the <audio> element from a stale buffer after a
pause, drifting behind the live point. Load the stream with an anti-cache
query parameter, and on resume-from-pause reconnect to live rather than
replaying the buffered audio.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The fallback played the whole /cache directory, which at cold start holds
only the 2-3 tracks being pre-fetched — so it looped them until the
request.dynamic buffer filled. Restrict the fallback to tracks already
aired: the ingest daemon exposes them at GET /fallback.m3u (played_at set,
still on disk), and the stream fetches that into a local /tmp/fallback.m3u
that playlist watches. Cold start is now silent (assumed) instead of a tight
loop, and a mid-stream drain degrades across the whole listening history.
A local file (not a remote playlist URL) is used to avoid Liquidsoap's http
resolver mis-sniffing the response as text/html; mime_type is forced so an
empty header-only m3u still parses.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Serve a small web page at http://<host>:8000/ (stream/index.html) from the
Liquidsoap harbor, alongside the /radio.mp3 stream. It shows the track
currently on air and refreshes it from a /nowplaying JSON endpoint, fed by the
broadcast source's live metadata — accurate even though the ingest daemon runs
a track ahead (prefetch).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The fallback playlist probed every file in /cache, including .gitkeep and
in-progress .part downloads, logging ffmpeg "Invalid data" warnings at startup.
Filter candidates with check_next to keep only real audio files and skip hidden
ones, removing the noise.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Insert a 3s crossfade after the fallback so it applies to both
daemon-driven transitions and cache fallbacks, before mksafe.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add the Python `ingest` container exposing `GET /next`, which returns the
next track as an annotated Liquidsoap URI (or an empty body when nothing is
ready). Liquidsoap switches from a static playlist to a `request.dynamic`
source pulling from the daemon, with the local cache as fallback and mksafe
for guaranteed continuous output.
For now the daemon just cycles through the files already in the cache; the
download providers (Navidrome, yt-dlp, ListenBrainz) come in later milestones.
Also commit the implementation plan (PLAN.md).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Liquidsoap (v2.4.5) container that plays the /cache directory in random
order and broadcasts it over HTTP at :8000/radio.mp3 (MP3 192 kbps).
mksafe guarantees a continuous stream (silence when the cache is empty).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>