fix(lidarr): add an album as the looked-up resource with its artist nested (#5234)
release / web (push) Successful in 1m42s
release / go (push) Successful in 2m7s
release / govulncheck (push) Successful in 37s
release / integration (push) Successful in 5m31s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / android (push) Canceled after 5m14s
release / Build signed APK (releases and dev) (push) Canceled after 4m42s

Lidarr's POST /api/v1/album validates `artist` as a nested resource
(AlbumController: RuleFor(s => s.Artist).NotNull()), so the flat payload
we sent was refused with "'Artist' must not be empty" every time. The
album add has never worked against a real Lidarr; approved album and
track requests sat in the reconciler retrying every 5 minutes.

AddAlbum now does what Lidarr's own add-album UI does (getNewAlbum /
getNewArtist): look the album up by MBID (album/lookup?term=lidarr:<mbid>),
then POST that resource back with monitored + searchForNewAlbum. When
Lidarr doesn't have the artist yet, the nested artist gets the request's
quality/metadata profile and root folder, monitors this album only
(monitor "none" + albumsToMonitor, which AlbumMonitoredService prefers)
and no future releases. An artist Lidarr already has is left as it is.
An MBID Lidarr's metadata doesn't know is ErrNotFound with no POST.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 10:55:41 -04:00
co-authored by Claude Opus 5.5
parent e8eee55325
commit 670b30c954
4 changed files with 204 additions and 46 deletions
+4 -4
View File
@@ -60,10 +60,10 @@ type AddArtistParams struct {
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).
// AddAlbumParams identify the album to add and carry the settings Lidarr
// needs when it has to create the parent artist on the fly (an album by an
// artist not yet in Lidarr). The artist fields are a fallback only: the
// album lookup normally supplies the artist itself.
type AddAlbumParams struct {
ForeignAlbumID string
ForeignArtistID string // Lidarr requires the artist's foreign id too