feat: radio stations that Sonda makes by itself

Stations made from the music, random and without end, with nothing to set up: the
mixes the listener has (genres, favourites, rediscover, new to you), everything,
one for each decade that has 30 songs by 4 artists, and the radio of an artist (their
songs, four times as likely, and the songs of the two genres most of theirs have).
Every time a station is asked for it picks other songs, with the same weights as the
mixes (taste, hearts, nothing skipped lately).

- mixes.Service.Radios and Radio; Filter has All and years, the store has Decades
- GET /radio and GET /radio/{id}, in the OpenAPI spec
- OpenSubsonic: each station is a playlist (rd-<id>, "Radio · Rock") that has other
  songs every time it is opened, for apps that cannot play a radio that never ends
This commit is contained in:
tgiachi 2026-11-16 12:13:55 +01:00
commit 407b20334a

View file

@ -887,6 +887,57 @@ export interface paths {
patch?: never;
trace?: never;
};
"/radio": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* The stations of your radio
* @description Stations that Sonda makes by itself from your music, for you alone: nobody makes them and there is nothing to
* set up. They are the mixes you have (`genre`, `favourites`, `rediscover`, `unheard`, see `GET /mixes`), then
* `all` (every song) and one `decade` for each decade that has at least 30 songs by at least 4 artists (from the
* year of the tags), the oldest first. The station of an artist, `artist:<id>`, is not in the list: it is asked
* for from the page of an artist. `title` is in English. Nothing is stored and nothing is sent to a provider.
*/
get: operations["listRadio"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/radio/{id}": {
parameters: {
query?: never;
header?: never;
path: {
/** @description A station of the list (`all`, `decade:1990`, `genre:rock`...) or `artist:<id>` for the songs of an artist and of the genres they play (percent-encoded). */
id: string;
};
cookie?: never;
};
/**
* Songs of a station
* @description Up to 50 songs, picked by weighted chance like a mix (the artists you play weigh more, songs you never played a
* bit more, songs played in the last days less; songs you skipped lately and artists you avoid do not come; at
* most 3 by one artist, never two by the same artist in a row), but **other songs every time you ask**: ask again
* when the queue is nearly over and the radio never ends. In the station of an artist their songs weigh four
* times as much. A station you do not have is `station_not_found`.
*/
get: operations["getRadio"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/mixes/{id}/playlist": {
parameters: {
query?: never;
@ -1484,6 +1535,13 @@ export interface paths {
* one skip does not sink an artist and listening makes one loved at most. A track with
* several artists credits each of them.
*
* **Favourites** count too (see `/me/favorites`), added to the sum of the artist they point at, without fading
* with time: a favourite artist +3 (as much as three complete listens), a favourite album +1.5 for its album
* artist, and a favourite song +1 for each of its main artists, at most +6 for one artist. An artist you
* marked but never played is liked, with `listens` 0 and `last_listened_at` at the zero date
* (`0001-01-01T00:00:00Z`). A heart is stronger than one skip. Discover, the mixes and the smart playlists that
* use your taste follow.
*
* `artists` are the ones you like (a `preference` above 0), the most played first. They are
* ordered by the sum itself, so artists whose `preference` rounds to 1 keep their order;
* ties go to the lower id. `tags` are the kinds of music you like, at most 50: the tags of
@ -3761,6 +3819,37 @@ export interface components {
/** @description In the order to play them. Fewer than 50 when the library has fewer to give. */
tracks: components["schemas"]["Track"][];
};
RadioStation: {
/** @description `all`, `decade:<year>`, `artist:<id>`, or the id of a mix: `favourites`, `rediscover`, `unheard`, `genre:<name>`. */
id: string;
/** @enum {string} */
kind: "genre" | "favourites" | "rediscover" | "unheard" | "all" | "decade" | "artist";
/** @description In English. */
title: string;
/** @description The genre, for a genre station; null for the others. */
genre: string | null;
/** @description The first year of the decade (1990), for a decade station; null for the others. */
decade: number | null;
/** @description A few of the artists it has, up to 3. */
artists: string[];
/** @description As in the list of mixes. */
album_ids: number[];
};
RadioStationList: {
items: components["schemas"]["RadioStation"][];
};
RadioStationWithTracks: {
id: string;
/** @enum {string} */
kind: "genre" | "favourites" | "rediscover" | "unheard" | "all" | "decade" | "artist";
title: string;
genre: string | null;
decade: number | null;
artists: string[];
album_ids: number[];
/** @description In the order to play them. Fewer than 50 when the library has fewer to give. */
tracks: components["schemas"]["Track"][];
};
SaveMix: {
/** @description The name of the playlist; blank or absent means the title of the mix. */
name?: string;
@ -4385,7 +4474,7 @@ export interface components {
listens: number;
/**
* Format: date-time
* @description The most recent listen that counted.
* @description The most recent listen that counted; the zero date (`0001-01-01T00:00:00Z`) for an artist that is liked only because of a favourite.
*/
last_listened_at: string;
};
@ -6107,6 +6196,60 @@ export interface operations {
404: components["responses"]["MixNotFound"];
};
};
listRadio: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description The stations. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["RadioStationList"];
};
};
401: components["responses"]["Unauthorized"];
};
};
getRadio: {
parameters: {
query?: never;
header?: never;
path: {
/** @description A station of the list (`all`, `decade:1990`, `genre:rock`...) or `artist:<id>` for the songs of an artist and of the genres they play (percent-encoded). */
id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description The station and its songs. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["RadioStationWithTracks"];
};
};
401: components["responses"]["Unauthorized"];
/** @description There is no such station (`station_not_found`). */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
saveMix: {
parameters: {
query?: never;