fix(lidarr): address review findings on HTTP client

- Add ArtistMBID/AlbumMBID to LookupResult so handlers can build the
  full lidarr_requests row from album/track lookups (parent MBID is
  needed for the AddAlbum API call and for the schema's NOT NULL
  lidarr_artist_mbid)
- Trim trailing slash on BaseURL before joining paths to avoid
  double-slash URLs when operators enter "http://lidarr.lan/"
- Check json.Marshal errors in AddArtist/AddAlbum
- Extract lidarrImage as a named unexported type instead of repeating
  the anonymous struct three times
- Add NewClient(baseURL, apiKey) constructor with 30s default timeout
- Add ErrLookupFailed test coverage for the 4xx-non-auth branch on
  both get and post helpers
- Rename TestListRootFolders_BadJSON -> _NullBody (it tests null,
  not malformed); add a real malformed-JSON test
- Defensive separator guard on LookupAlbum.Secondary so an empty
  ArtistName doesn't produce a leading " · "

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 16:26:23 -04:00
parent a43fa09a04
commit ebff8f69a0
5 changed files with 161 additions and 64 deletions
+2
View File
@@ -1,6 +1,7 @@
[
{
"foreignAlbumId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"foreignArtistId": "069b64b6-7884-4f6a-94cc-e4c1d6c87a01",
"title": "Music Has the Right to Children",
"artistName": "Boards of Canada",
"releaseDate": "1998-04-27",
@@ -12,6 +13,7 @@
},
{
"foreignAlbumId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"foreignArtistId": "069b64b6-7884-4f6a-94cc-e4c1d6c87a01",
"title": "Geogaddi",
"artistName": "Boards of Canada",
"releaseDate": "2002-02-11",
+4
View File
@@ -1,12 +1,16 @@
[
{
"foreignTrackId": "t1a2b3c4-d5e6-7890-abcd-ef1234567890",
"foreignAlbumId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"foreignArtistId": "069b64b6-7884-4f6a-94cc-e4c1d6c87a01",
"title": "Roygbiv",
"albumTitle": "Music Has the Right to Children",
"artistName": "Boards of Canada"
},
{
"foreignTrackId": "t2b3c4d5-e6f7-8901-bcde-f12345678901",
"foreignAlbumId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"foreignArtistId": "069b64b6-7884-4f6a-94cc-e4c1d6c87a01",
"title": "Aquarius",
"albumTitle": "Music Has the Right to Children",
"artistName": "Boards of Canada"