stream: show the source provider of the current track
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
96a1ba89e6
commit
bfa7cc1046
3 changed files with 40 additions and 5 deletions
|
|
@ -37,6 +37,10 @@
|
|||
color: #9b8cff; margin-bottom: 1.75rem; }
|
||||
.np-label { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
|
||||
color: #7d768f; margin-bottom: .5rem; }
|
||||
/* Provenance discrète du morceau : d'où vient la piste (OpenSubsonic,
|
||||
YouTube…). Ton effacé, glissée à la suite de l'état « en cours ». */
|
||||
.provider { color: #6b6480; }
|
||||
.provider::before { content: "·"; margin: 0 .35em; color: #4a4560; }
|
||||
.title { font-size: 1.55rem; font-weight: 650; line-height: 1.25;
|
||||
word-wrap: break-word; }
|
||||
.title a { color: inherit; text-decoration: none; transition: color .15s; }
|
||||
|
|
@ -98,7 +102,7 @@
|
|||
<div class="bg" id="bg"></div>
|
||||
<main class="card">
|
||||
<div class="logo" id="stationName">◈</div>
|
||||
<div class="np-label"><span class="dot"></span><span id="npLabel">Préchargement</span></div>
|
||||
<div class="np-label"><span class="dot"></span><span id="npLabel">Préchargement</span><span id="provider" class="provider" hidden></span></div>
|
||||
<div class="title" id="title">—</div>
|
||||
<div class="artist" id="artist"></div>
|
||||
<audio id="player" controls autoplay preload="none"></audio>
|
||||
|
|
@ -151,8 +155,20 @@
|
|||
const titleEl = document.getElementById("title");
|
||||
const artistEl = document.getElementById("artist");
|
||||
const npLabel = document.getElementById("npLabel");
|
||||
const providerEl = document.getElementById("provider");
|
||||
const player = document.getElementById("player");
|
||||
|
||||
// Noms d'affichage des providers d'ingestion (champ `origin` du morceau).
|
||||
// Inconnu → on réutilise tel quel, faute de mieux.
|
||||
const PROVIDER_NAMES = {
|
||||
subsonic: "OpenSubsonic",
|
||||
ytdlp: "YouTube",
|
||||
listenbrainz: "ListenBrainz",
|
||||
// Filet de secours : morceau rejoué depuis le cache local (déjà diffusé),
|
||||
// quand l'ingest n'a rien à proposer (démarrage, panne…).
|
||||
cache: "le cache local",
|
||||
};
|
||||
|
||||
// Tant que le buffer de préchargement (PREFETCH côté ingest) n'est pas
|
||||
// rempli, on affiche « Préchargement N/M » plutôt que « en cours ». L'info
|
||||
// vient du daemon d'ingestion, relayée par le stream via /ingest/status.
|
||||
|
|
@ -279,6 +295,14 @@
|
|||
? `<a href="${escapeHtml(u)}" target="_blank" rel="noopener">${escapeHtml(label)}</a>`
|
||||
: escapeHtml(label);
|
||||
artistEl.textContent = a;
|
||||
// Provenance discrète : nom lisible du provider, masqué s'il est absent.
|
||||
const origin = (m.origin || "").trim();
|
||||
if (origin) {
|
||||
providerEl.textContent = "via " + (PROVIDER_NAMES[origin] || origin);
|
||||
providerEl.hidden = false;
|
||||
} else {
|
||||
providerEl.hidden = true;
|
||||
}
|
||||
document.title = t ? (a ? `${t} — ${a} · ${STATION_NAME}` : `${t} · ${STATION_NAME}`) : STATION_NAME;
|
||||
updateMediaSession(t, a);
|
||||
} catch (e) { /* keep last known values */ }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue