fix(lidarr): include artistName + metadataProfileId on add-artist/add-album
The 'lidarr_rejected' the operator was hitting on Approve was Lidarr 4xx-ing the POST with two field-validation errors: 'Metadata Profile Id' must be greater than '0'. 'Artist Name' must not be empty. Our payload was missing both. Lidarr's metadata profile is a separate concept from quality profile (it controls which release types are tracked: albums, singles, EPs, etc.) and is required by /api/v1/artist and /api/v1/album. The 'already exists' line in the toast copy was an incorrect guess at the cause; the real issue was an invalid payload. Changes: - internal/lidarr/types.go: AddArtistParams + AddAlbumParams gain ArtistName and MetadataProfileID. New MetadataProfile struct mirroring QualityProfile. - internal/lidarr/client.go: AddArtist + AddAlbum payloads include both new fields. New ListMetadataProfiles fetches GET /api/v1/metadataprofile. - internal/lidarrrequests/service.go: Approve fetches the metadata profile list and uses the first as a default (Lidarr installs ship 'Standard' at id=1 OOB, so this works for vanilla setups). Picker on /admin/integrations is a follow-up. ArtistName flows from the request row. - web/src/routes/admin/requests/+page.svelte: drop the speculative 'usually means already in library' copy on lidarr_rejected; point operators at server logs for the field-level reason instead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,16 @@ type QualityProfile struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// MetadataProfile controls which release types Lidarr tracks for an artist
|
||||
// (album / single / EP / compilation). It's a separate Lidarr concept from
|
||||
// quality profile and is required on POST /api/v1/artist — Lidarr 4xx's
|
||||
// the request with "'Metadata Profile Id' must be greater than '0'" if
|
||||
// it's missing or zero.
|
||||
type MetadataProfile struct {
|
||||
ID int
|
||||
Name string
|
||||
}
|
||||
|
||||
// RootFolder is the dropdown choice in /admin/integrations.
|
||||
type RootFolder struct {
|
||||
Path string
|
||||
@@ -39,19 +49,28 @@ type RootFolder struct {
|
||||
}
|
||||
|
||||
// AddArtistParams are the fields Lidarr requires on POST /api/v1/artist.
|
||||
// ArtistName and MetadataProfileID are both required; omitting either
|
||||
// produces a 400 with field-validation errors.
|
||||
type AddArtistParams struct {
|
||||
ForeignArtistID string
|
||||
QualityProfileID int
|
||||
RootFolderPath string
|
||||
MonitorAll bool // true => monitor="all"; false => "future"
|
||||
ForeignArtistID string
|
||||
ArtistName string
|
||||
QualityProfileID int
|
||||
MetadataProfileID int
|
||||
RootFolderPath string
|
||||
MonitorAll bool // true => monitor="all"; false => "future"
|
||||
}
|
||||
|
||||
// AddAlbumParams are the fields Lidarr requires on POST /api/v1/album.
|
||||
// MetadataProfileID is included for the case where Lidarr has to create
|
||||
// the parent artist on the fly (when adding an album by an artist not
|
||||
// yet in the library).
|
||||
type AddAlbumParams struct {
|
||||
ForeignAlbumID string
|
||||
ForeignArtistID string // Lidarr requires the artist's foreign id too
|
||||
QualityProfileID int
|
||||
RootFolderPath string
|
||||
ForeignAlbumID string
|
||||
ForeignArtistID string // Lidarr requires the artist's foreign id too
|
||||
ArtistName string
|
||||
QualityProfileID int
|
||||
MetadataProfileID int
|
||||
RootFolderPath string
|
||||
}
|
||||
|
||||
// PingResult is the response shape from GET /api/v1/system/status.
|
||||
|
||||
Reference in New Issue
Block a user