Música se ordena: pestañas, buscador, y listas de diez con "Mostrar más"
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
La pantalla era una sola columna —radio, después podcasts, después listas— y tres listas de veinte filas es una pantalla por la que se baja buscando lo que ya sabías que querías. Ahora pregunta primero: **Radio | Podcasts | Listas**, una lista a la vez, **diez filas** y un **"Mostrar más"** que dice cuántas esconde. Nada queda fuera de alcance y nada más está en pantalla mientras decidís: el subtítulo también dice qué estás mirando en vez de hablar siempre de listas. El **buscador** busca lo que tengas abierto y en el origen, no en la página: `jazz` le pregunta al directorio de emisoras y `crimen` al de podcasts de Apple —filtrado, como siempre, a español, y pasando por **la misma** función de filtro que una categoría, porque un segundo camino más barato al catálogo es como se pierde una regla—. Con menos de dos letras no se busca ni se pide nada: una letra coincide con todo y sería una petición por tecla para una respuesta inservible. La búsqueda de emisoras **ordena por lo que se buscó**: el directorio coincide con subcadenas en cualquier parte, así que *techno* devolvía "# TOP 100 CLUB CHARTS - DANCE & DJ MIX RADIO" —real, con "techno" entre sus etiquetas— por delante de toda emisora llamada Techno Algo. El nombre pesa antes que la popularidad y a igual peso gana el nombre más corto; los canales de SomaFM y los mixes de Paradise que coinciden van primero, porque no tienen publicidad y su stream ya se sabe que funciona. La búsqueda del directorio va con `is_https=true`, cacheada por consulta. `lib/paging.js` es puro y tiene test porque tiene un borde fácil de equivocar en un componente: una lista que se encoge —una búsqueda nueva, una emisora desmarcada— no puede dejar el tamaño de página pasado del final, que se ve como "Mostrar más" que no hace nada. Verificado contra los directorios reales: `radio?q=jazz` → Sonic Universe (SomaFM) y después Jazz 24; `radio?q=miami` → Miami Beach Radio, 105 Miami; `podcasts?q=crimen` → 20 programas en español (es, es-ar) y `q=entrenamiento en casa` → 3; `?q=j` no busca. `relevance` y `rankStations` se comprobaron por mutación: sacar el orden hace fallar el test que lo mira de punta a punta.
This commit is contained in:
1 parent
22654c61fc
commit
d5cf0d8d64
16 files changed
+845
-81
No files matched your search
+13
-2
@@ -1026,8 +1026,14 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
|
||||
<p>The audio never passes through this server. The list is the whole feature on this side: the phone then talks to the station directly, so this instance spends no bandwidth and keeps no copy of anything. Sources are SomaFM (commercial-free) and Radio Paradise for the curated picks, and the public radio-browser directory for the rest, filtered to HTTPS and to codecs a browser plays without a library (HLS streams are skipped — that would mean shipping a player library).</p>
|
||||
<p>A session is required. Not to protect the stations — they are public — but because this container sits on the owner's own network and fetches on behalf of whoever asks.</p>
|
||||
<p>An unknown or missing <code>genre</code> is not an error: it falls back to the first genre.</p>
|
||||
<p><b><code>?q=</code> searches instead of browsing</b>, and it is the same route on purpose: the screen has one list, and what fills it changes. A query is matched against the curated channels and Radio Paradise mixes locally, and the directory is asked by name — ordered by how many people listen, then re-ordered so a station <i>called</i> "Jazz 24" comes before one with "jazz" buried in a forty-character marketing name. A query shorter than two characters is not a search and answers an empty list without asking anybody.</p>
|
||||
<p class="ep-auth"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2.5"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/></svg><span>Requires a session — the cookie set at sign-in, or <code>Authorization: Bearer <token></code> from mobile-app pairing.</span></p>
|
||||
<p class="ep-h">Query parameters</p><div class="ptab">
|
||||
<div class="prow">
|
||||
<span class="p-name">q</span>
|
||||
<span class="p-type">string <span class="p-hint">(≤ 60 chars)</span></span>
|
||||
<span class="p-desc">A name search. Two characters or more; when present, <code>genre</code> is ignored.</span>
|
||||
</div>
|
||||
<div class="prow">
|
||||
<span class="p-name">genre</span>
|
||||
<span class="p-type">"workout" | "techno" | "rnb" | "latin" | "hiphop" | "reggae" | "chill" | "jazz" | "rock" | "electronic"</span>
|
||||
@@ -1039,7 +1045,7 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
|
||||
<div class="ptab">
|
||||
<div class="prow rrow">
|
||||
<span class="r-code s2">200</span>
|
||||
<span class="p-desc">The genres for the chips, and the stations for the one that was asked for.<span class="r-sig">{ ok: boolean, genres: object[], genre: string, label: string, stations: <a href="#schema-RadioStation">RadioStation</a>[] }</span></span>
|
||||
<span class="p-desc">The genres for the chips, and the stations for the one that was asked for.<span class="r-sig">{ ok: boolean, genres: object[], genre: string, label: string, query: string, stations: <a href="#schema-RadioStation">RadioStation</a>[] }</span></span>
|
||||
</div>
|
||||
<div class="prow rrow">
|
||||
<span class="r-code s4">401</span>
|
||||
@@ -1111,13 +1117,18 @@ main.api-main .lead { color: var(--fg-2); max-width: 58ch; margin: 14px 0 0; fon
|
||||
<span class="p-type">"fitness" | "sports" | "comedy" | "news" | "history" | "truecrime" | "science" | "tech" | "society" | "business" | "fiction" | "education" | "music" | "leisure"</span>
|
||||
<span class="p-desc">Category key. Missing or unrecognised falls back to <code>fitness</code>.</span>
|
||||
</div>
|
||||
<div class="prow">
|
||||
<span class="p-name">q</span>
|
||||
<span class="p-type">string <span class="p-hint">(≤ 80 chars)</span></span>
|
||||
<span class="p-desc">A search by name. Two characters or more; when present, <code>category</code> is ignored and the same Spanish-language check runs on the results as on a category's chart entries — a search is not a second, weaker way into the catalogue.</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="ep-h">Responses</p>
|
||||
<div class="ptab">
|
||||
<div class="prow rrow">
|
||||
<span class="r-code s2">200</span>
|
||||
<span class="p-desc">The categories for the chips, and the Spanish shows in the one asked for.<span class="r-sig">{ ok: boolean, categories: object[], category: string, label: string, shows: <a href="#schema-PodcastShow">PodcastShow</a>[], skipped: object }</span></span>
|
||||
<span class="p-desc">The categories for the chips, and the Spanish shows in the one asked for.<span class="r-sig">{ ok: boolean, categories: object[], category: string, label: string, query: string, shows: <a href="#schema-PodcastShow">PodcastShow</a>[], skipped: object }</span></span>
|
||||
</div>
|
||||
<div class="prow rrow">
|
||||
<span class="r-code s4">401</span>
|
||||
|
||||
Reference in new issue
Block a user