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

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:
dsantillan committed 2026-09-23 21:24:50 -04:00
1 parent 22654c61fc
commit d5cf0d8d64
16 files changed
+845 -81

No files matched your search

+23 -3
View File
@@ -961,7 +961,18 @@ paths:
container sits on the owner's own network and fetches on behalf of whoever asks.
An unknown or missing `genre` is not an error: it falls back to the first genre.
**`?q=` searches instead of browsing**, 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 *called* "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.
parameters:
- name: q
in: query
schema: { type: string, maxLength: 60 }
description: A name search. Two characters or more; when present, `genre` is ignored.
- name: genre
in: query
schema:
@@ -985,8 +996,9 @@ paths:
properties:
key: { type: string }
label: { type: string }
genre: { type: string, description: The genre actually answered with. }
label: { type: string, description: That genre's human label. }
genre: { type: string, description: The genre actually answered with. Absent on a search. }
label: { type: string, description: That genre's human label. Absent on a search. }
query: { type: string, description: Present only on a search — the normalised query that was used. }
stations:
type: array
description: Curated, ad-free picks first, then the directory. At most 40.
@@ -1074,6 +1086,13 @@ paths:
type: string
enum: [fitness, sports, comedy, news, history, truecrime, science, tech, society, business, fiction, education, music, leisure]
description: Category key. Missing or unrecognised falls back to `fitness`.
- name: q
in: query
schema: { type: string, maxLength: 80 }
description: >-
A search by name. Two characters or more; when present, `category` 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.
responses:
'200':
description: The categories for the chips, and the Spanish shows in the one asked for.
@@ -1091,8 +1110,9 @@ paths:
properties:
key: { type: string }
label: { type: string, description: Spanish label, like the rest of the show list. }
category: { type: string, description: The category actually answered with. }
category: { type: string, description: The category actually answered with. Absent on a search. }
label: { type: string }
query: { type: string, description: Present only on a search — the term that was used. }
shows:
type: array
description: At most 20, Spanish-language only.