feat(web): the Request on Lidarr button, for admins, with a confirmation first
Only an admin gets it. It reads what Lidarr has before showing itself (or, on a list card, not at all), asks before sending, sends one artist once, and explains every outcome in words, including a timeout that rereads the state. The API types are regenerated from the spec, which gained the Lidarr endpoints and providers since they were last built.
This commit is contained in:
parent
9dcb7637e7
commit
67205ec2e1
1 changed files with 654 additions and 13 deletions
308
web/src/api/schema.d.ts
vendored
308
web/src/api/schema.d.ts
vendored
|
|
@ -634,6 +634,11 @@ export interface paths {
|
|||
* is still used, so the list can be empty. With every seed's data stored and fresh the status is `ok`
|
||||
* whether Last.fm is on or not. It is `error` when Last.fm failed for some seed (the
|
||||
* rest is still returned) and `ok` otherwise. Show `attribution` where you show the data.
|
||||
*
|
||||
* **How many at once.** One Discover at a time for each listener (a second one answers 429
|
||||
* `discover_busy`), and at most three at the same time on the server: a request that finds them
|
||||
* busy waits for its turn (at most 30 seconds, then it answers 429 as well), and leaves without
|
||||
* doing any work if the client gives up. A request that waits for its turn counts as running.
|
||||
*/
|
||||
get: operations["discover"];
|
||||
put?: never;
|
||||
|
|
@ -818,6 +823,46 @@ export interface paths {
|
|||
patch: operations["updateMySettings"];
|
||||
trace?: never;
|
||||
};
|
||||
"/artists/{id}/lidarr": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: components["parameters"]["Id"];
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* Whether Lidarr has an artist
|
||||
* @description Asks your own Lidarr, by the artist's MusicBrainz id and never by name, whether it has the artist and
|
||||
* whether it monitors it. Like the descriptions, whatever stops the answer is a status and not an error:
|
||||
* `disabled` when the `lidarr` provider is off (nobody is asked), `no_id` when the artist has no MusicBrainz id,
|
||||
* `not_configured` when Lidarr has no address or key, `error` when it could not be asked now. Only the id and
|
||||
* the API key go out, to the address an admin set.
|
||||
*/
|
||||
get: operations["getArtistInLidarr"];
|
||||
put?: never;
|
||||
/**
|
||||
* Send an artist to Lidarr
|
||||
* @description Admin only. Adds the artist to your own Lidarr, which then looks for and downloads the music by itself:
|
||||
* Sonda downloads nothing, and does this only when an admin asks, for one artist, never by itself. It works
|
||||
* for any artist that has a MusicBrainz id, also one that Sonda only learned of from a list of similar
|
||||
* artists, which is the point: asking for music you do not have. It never looks an id up by name.
|
||||
*
|
||||
* It uses what an admin set in `PUT /providers/lidarr`: the quality profile, the metadata profile, the root
|
||||
* folder, which of the albums to monitor and whether Lidarr starts searching at once. It needs the provider
|
||||
* switched on and those chosen. An artist that Lidarr already has is not an error (`already_added`, nothing
|
||||
* changes), so the call can be repeated. If Lidarr does not answer in time, the artist may have been added
|
||||
* all the same: read it with `GET /artists/{id}/lidarr`. Only the MusicBrainz id and the API key go out,
|
||||
* to the address an admin set.
|
||||
*/
|
||||
post: operations["sendArtistToLidarr"];
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/artists/{id}/description": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
|
|
@ -1097,7 +1142,7 @@ export interface paths {
|
|||
};
|
||||
/**
|
||||
* List the external providers
|
||||
* @description Admin only. Every provider Sonda knows (Last.fm, MusicBrainz), with whether it is on and
|
||||
* @description Admin only. Every provider Sonda knows (Last.fm, MusicBrainz, Wikipedia, Commons, the Cover Art Archive and Lidarr), with whether it is on and
|
||||
* what it would send. Providers are off by default: nothing leaves the server until an admin
|
||||
* enables one. The API key is never returned; `has_api_key` says whether one is stored.
|
||||
*/
|
||||
|
|
@ -1110,19 +1155,42 @@ export interface paths {
|
|||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/providers/lidarr/options": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
/**
|
||||
* What Lidarr offers to choose from
|
||||
* @description Admin only. Reads Lidarr's quality profiles, metadata profiles and root folders, so an admin can pick
|
||||
* the ones to send artists with (`PUT /providers/lidarr`, field `lidarr`). It works whether Lidarr is
|
||||
* switched on or not, since it is needed to finish setting it up, and it sends nothing but the API key,
|
||||
* to the address set for Lidarr, which is your own server.
|
||||
*/
|
||||
get: operations["getLidarrOptions"];
|
||||
put?: never;
|
||||
post?: never;
|
||||
delete?: never;
|
||||
options?: never;
|
||||
head?: never;
|
||||
patch?: never;
|
||||
trace?: never;
|
||||
};
|
||||
"/providers/{name}": {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
get?: never;
|
||||
/**
|
||||
* Set up a provider
|
||||
* @description Admin only. Send any of `enabled`, `api_key` and `contact`; fields you leave out are kept.
|
||||
* @description Admin only. Send any of `enabled`, `api_key`, `contact`, `url` and `lidarr`; fields you leave out are kept.
|
||||
*
|
||||
* The key is write-only: it is never returned and never logged. Sending an empty `api_key`
|
||||
* clears it, and turns a provider that needs a key (Last.fm) off; a provider that needs none
|
||||
|
|
@ -1142,7 +1210,7 @@ export interface paths {
|
|||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
|
|
@ -1171,7 +1239,7 @@ export interface paths {
|
|||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
|
|
@ -1434,14 +1502,19 @@ export interface components {
|
|||
};
|
||||
Provider: {
|
||||
/** @enum {string} */
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
/** @description Whether Sonda may contact this provider. */
|
||||
enabled: boolean;
|
||||
needs_api_key: boolean;
|
||||
/** @description Whether the provider is a server of your own that needs an address (only Lidarr). */
|
||||
needs_url: boolean;
|
||||
/** @description Whether a key is stored. The key itself is never returned. */
|
||||
has_api_key: boolean;
|
||||
/** @description Contact in the User-Agent; empty means the project address. */
|
||||
contact: string;
|
||||
/** @description Where your own server is, without a closing slash. Empty for the providers that have none. */
|
||||
url: string;
|
||||
lidarr?: components["schemas"]["LidarrOptions"];
|
||||
/** @description Plain statement of what is sent to the provider, and what never is. */
|
||||
sends: string;
|
||||
/** @description Terms of use and attribution that apply to the provider's data. */
|
||||
|
|
@ -1452,16 +1525,74 @@ export interface components {
|
|||
*/
|
||||
updated_at: string | null;
|
||||
};
|
||||
/**
|
||||
* @description Only for `lidarr`: what is sent to Lidarr when an artist is added, chosen once by an admin from
|
||||
* `GET /providers/lidarr/options`. Until they are saved, `monitor` is `all`, `search_missing` is
|
||||
* true and the rest is empty or 0, which is not enough to add an artist.
|
||||
*/
|
||||
LidarrOptions: {
|
||||
/** @description Lidarr's quality profile; 0 when none is chosen. */
|
||||
quality_profile_id: number;
|
||||
/** @description Lidarr's metadata profile; 0 when none is chosen. */
|
||||
metadata_profile_id: number;
|
||||
/** @description One of Lidarr's root folders; empty when none is chosen. */
|
||||
root_folder_path: string;
|
||||
/**
|
||||
* @description Which of the artist's albums Lidarr monitors when it is added. `none` also stops new albums from being monitored.
|
||||
* @enum {string}
|
||||
*/
|
||||
monitor: "all" | "future" | "missing" | "existing" | "latest" | "first" | "none";
|
||||
/** @description Whether Lidarr starts looking for the albums as soon as the artist is added. */
|
||||
search_missing: boolean;
|
||||
};
|
||||
LidarrOffers: {
|
||||
quality_profiles: components["schemas"]["LidarrProfile"][];
|
||||
metadata_profiles: components["schemas"]["LidarrProfile"][];
|
||||
root_folders: {
|
||||
path: string;
|
||||
/** @description Whether Lidarr can use the folder now. */
|
||||
accessible: boolean;
|
||||
}[];
|
||||
};
|
||||
ArtistInLidarr: {
|
||||
/**
|
||||
* @description `ok` when Lidarr was asked (and `in_lidarr` is its answer); the others say why it was not.
|
||||
* @enum {string}
|
||||
*/
|
||||
provider_status: "ok" | "disabled" | "no_id" | "not_configured" | "error";
|
||||
in_lidarr: boolean;
|
||||
/** @description Whether Lidarr monitors the artist; false when it does not have it. */
|
||||
monitored: boolean;
|
||||
};
|
||||
LidarrProfile: {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
ProviderUpdate: {
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Format: password
|
||||
* @description A Last.fm key is 32 hexadecimal characters. Empty clears it.
|
||||
* @description A Last.fm or Lidarr key is 32 hexadecimal characters. Empty clears it.
|
||||
*/
|
||||
api_key?: string;
|
||||
/**
|
||||
* @description Only for Lidarr: where your own server is, `http://` or `https://`, with a port and a path if it
|
||||
* has them, and without user and password, query or fragment. A closing slash is dropped. Empty
|
||||
* clears it, and turns Lidarr off. Lidarr cannot be enabled without an address and a key.
|
||||
*/
|
||||
url?: string;
|
||||
/** @description Only for Lidarr. Replaces all its options at once: what is left out is the default (`monitor` all, `search_missing` true, the rest empty or 0). */
|
||||
lidarr?: {
|
||||
quality_profile_id?: number;
|
||||
metadata_profile_id?: number;
|
||||
root_folder_path?: string;
|
||||
/** @enum {string} */
|
||||
monitor?: "all" | "future" | "missing" | "existing" | "latest" | "first" | "none";
|
||||
search_missing?: boolean;
|
||||
};
|
||||
/** @description A URL or e-mail address, without parentheses. Empty restores the default. */
|
||||
contact?: string;
|
||||
} | unknown | unknown | unknown;
|
||||
} | unknown | unknown | unknown | unknown | unknown;
|
||||
ArtistDescription: {
|
||||
/** @enum {string} */
|
||||
provider: "wikipedia";
|
||||
|
|
@ -1532,11 +1663,11 @@ export interface components {
|
|||
ProviderTest: {
|
||||
ok: boolean;
|
||||
/**
|
||||
* @description `no_api_key`: none is stored, so nobody was asked. `key_refused`: the provider does not accept
|
||||
* @description `no_api_key`: none is stored, so nobody was asked. `no_address`: Lidarr has no address yet, so nobody was asked. `key_refused`: the provider does not accept
|
||||
* it. `rate_limited`: try again later. `unreachable`: the provider did not answer. `error`: anything else.
|
||||
* @enum {string}
|
||||
*/
|
||||
status: "ok" | "no_api_key" | "key_refused" | "rate_limited" | "unreachable" | "error";
|
||||
status: "ok" | "no_api_key" | "no_address" | "key_refused" | "rate_limited" | "unreachable" | "error";
|
||||
};
|
||||
ArtistTags: {
|
||||
sources: {
|
||||
|
|
@ -2942,6 +3073,17 @@ export interface operations {
|
|||
};
|
||||
};
|
||||
401: components["responses"]["Unauthorized"];
|
||||
/** @description You already have a Discover running or waiting for its turn, or the server was too busy to give it one in 30 seconds (`discover_busy`). Ask again after `Retry-After` seconds. */
|
||||
429: {
|
||||
headers: {
|
||||
/** @description Seconds to wait before asking again. */
|
||||
"Retry-After"?: number;
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
listDismissed: {
|
||||
|
|
@ -3192,6 +3334,106 @@ export interface operations {
|
|||
401: components["responses"]["Unauthorized"];
|
||||
};
|
||||
};
|
||||
getArtistInLidarr: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: components["parameters"]["Id"];
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description Whether Lidarr has the artist. */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["ArtistInLidarr"];
|
||||
};
|
||||
};
|
||||
400: components["responses"]["InvalidInput"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
/** @description No such artist (`artist_not_found`). */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
sendArtistToLidarr: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
id: components["parameters"]["Id"];
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description The artist is in Lidarr. */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": {
|
||||
/**
|
||||
* @description `added` now, or `already_added` when Lidarr had it.
|
||||
* @enum {string}
|
||||
*/
|
||||
status: "added" | "already_added";
|
||||
};
|
||||
};
|
||||
};
|
||||
400: components["responses"]["InvalidInput"];
|
||||
401: components["responses"]["Unauthorized"];
|
||||
403: components["responses"]["AdminRequired"];
|
||||
/** @description No such artist (`artist_not_found`). */
|
||||
404: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description The provider is switched off (`lidarr_disabled`), or has no address or key, or the profiles and the folder were not chosen (`lidarr_not_configured`). */
|
||||
409: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description The artist has no MusicBrainz id (`no_musicbrainz_id`), Lidarr does not know the id (`lidarr_unknown_artist`), or it refused the artist (`lidarr_rejected`, with its reason). */
|
||||
422: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Lidarr refused the key (`lidarr_key_refused`), or could not be asked or did not answer in time (`lidarr_unavailable`; the artist may have been added). */
|
||||
502: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
getArtistDescription: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
|
|
@ -3836,12 +4078,52 @@ export interface operations {
|
|||
403: components["responses"]["AdminRequired"];
|
||||
};
|
||||
};
|
||||
getLidarrOptions: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path?: never;
|
||||
cookie?: never;
|
||||
};
|
||||
requestBody?: never;
|
||||
responses: {
|
||||
/** @description What Lidarr offers. */
|
||||
200: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["LidarrOffers"];
|
||||
};
|
||||
};
|
||||
401: components["responses"]["Unauthorized"];
|
||||
403: components["responses"]["AdminRequired"];
|
||||
/** @description Lidarr has no address or no API key yet (`lidarr_not_configured`). */
|
||||
409: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
/** @description Lidarr refused the key (`lidarr_key_refused`), or could not be asked or answered something unexpected (`lidarr_unavailable`). */
|
||||
502: {
|
||||
headers: {
|
||||
[name: string]: unknown;
|
||||
};
|
||||
content: {
|
||||
"application/json": components["schemas"]["Error"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
updateProvider: {
|
||||
parameters: {
|
||||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
|
|
@ -3879,7 +4161,7 @@ export interface operations {
|
|||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
|
|
@ -3913,7 +4195,7 @@ export interface operations {
|
|||
query?: never;
|
||||
header?: never;
|
||||
path: {
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive";
|
||||
name: "lastfm" | "musicbrainz" | "wikipedia" | "commons" | "coverartarchive" | "lidarr";
|
||||
};
|
||||
cookie?: never;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue