feat: favourites of songs, albums and artists, in the API and in apps

A person can mark songs, albums and artists as favourites. They are theirs
alone: never shown to a friend, never sent anywhere. Only what can be played is
listed.

- migration 0035 favorites, internal/favorites, storage.FavoritesRepo
- PUT/DELETE /me/favorites/{kind}/{id}, GET /me/favorites/{kind} and
  GET /me/favorites/ids, in the OpenAPI spec
- catalog.Filter IDs now also reads artists by id
- OpenSubsonic: star, unstar, getStarred2, the starred date on songs, albums and
  artists, and getAlbumList2 of type starred
This commit is contained in:
tgiachi 2026-11-16 10:51:07 +01:00
commit 74f683d26e

View file

@ -1620,6 +1620,72 @@ export interface paths {
patch?: never;
trace?: never;
};
"/me/favorites/ids": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* The ids of all your favourites
* @description The ids of every artist, album and track you marked as a favourite, newest first, so that an app can show a
* heart in any list with one call. Only music that can be played is listed. Yours alone: never shown to a friend.
*/
get: operations["listMyFavoriteIds"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/me/favorites/{kind}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* A page of your favourites of one kind
* @description The artists, albums or tracks you marked as favourites, the newest favourite first, in the same shape as the
* lists of the catalogue. Only music that can be played is listed.
*/
get: operations["listMyFavorites"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/me/favorites/{kind}/{id}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get?: never;
/**
* Mark something as a favourite
* @description Marks an artist, album or track of this server as a favourite. Marking it again changes nothing and keeps the first date.
*/
put: operations["addMyFavorite"];
post?: never;
/**
* Take something out of your favourites
* @description Unmarks it. Unmarking what is not a favourite is not an error.
*/
delete: operations["removeMyFavorite"];
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/me/devices": {
parameters: {
query?: never;
@ -4254,6 +4320,11 @@ export interface components {
}[];
};
};
FavoriteIds: {
artists: number[];
albums: number[];
tracks: number[];
};
Device: {
/** Format: int64 */
id: number;
@ -4582,6 +4653,8 @@ export interface components {
};
};
parameters: {
/** @description What the favourites are of. */
FavoriteKind: "artists" | "albums" | "tracks";
Id: number;
/**
* @description Case- and accent-insensitive substring of the name or title: `bjork`, `BJORK` and `BJÖRK` all
@ -7200,6 +7273,131 @@ export interface operations {
401: components["responses"]["Unauthorized"];
};
};
listMyFavoriteIds: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Your favourites by kind. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["FavoriteIds"];
};
};
401: components["responses"]["Unauthorized"];
};
};
listMyFavorites: {
parameters: {
query?: {
/** @description Page size. 50 when absent or 0; values above 200 are lowered to 200. */
limit?: components["parameters"]["Limit"];
offset?: components["parameters"]["Offset"];
};
header?: never;
path: {
/** @description What the favourites are of. */
kind: components["parameters"]["FavoriteKind"];
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description A page of artists, albums or tracks, according to `kind`. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["ArtistPage"] | components["schemas"]["AlbumPage"] | components["schemas"]["TrackPage"];
};
};
400: components["responses"]["InvalidInput"];
401: components["responses"]["Unauthorized"];
/** @description There are no favourites of that kind (`not_found`). */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
addMyFavorite: {
parameters: {
query?: never;
header?: never;
path: {
/** @description What the favourites are of. */
kind: components["parameters"]["FavoriteKind"];
id: number;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Marked. */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
400: components["responses"]["InvalidInput"];
401: components["responses"]["Unauthorized"];
/** @description There is no such kind (`not_found`), or no such music that can be played (`artist_not_found`, `album_not_found`, `track_not_found`). */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
removeMyFavorite: {
parameters: {
query?: never;
header?: never;
path: {
/** @description What the favourites are of. */
kind: components["parameters"]["FavoriteKind"];
id: number;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Unmarked. */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
400: components["responses"]["InvalidInput"];
401: components["responses"]["Unauthorized"];
/** @description There is no such kind (`not_found`). */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["Error"];
};
};
};
};
listMyDevices: {
parameters: {
query?: never;