feat(db/m7-cover-sources): SQL queries for provider settings + recheck

- Extends GetAlbumCoverageRollup's with_art FILTER to include
  'theaudiodb' so F's coverage gauge surfaces TheAudioDB-found rows
  as with_art rather than silently undercounting.
- Modifies ListAlbumsMissingCover to take the current sources_version
  as a parameter; eligibility now includes stale-'none' rows.
- Adds SetAlbumCoverWithVersion (atomic write of path + source +
  version stamp) and the parallel SetArtistArtWithVersion +
  ClearArtistArtNone + ListArtistsMissingArt for the artist-art
  enricher.
- New coverart_settings.sql with ListProviderSettings,
  UpsertProviderSettings (boot reconciliation, preserves operator
  values on conflict), UpdateProviderSettings (admin PATCH; tri-
  state api_key handling), GetCurrentSourcesVersion,
  BumpSourcesVersion (RETURNING the new value).
This commit is contained in:
2026-05-06 12:28:18 -04:00
parent a86897b35e
commit 526a78b302
12 changed files with 550 additions and 88 deletions
+43 -23
View File
@@ -188,25 +188,30 @@ func (ns NullLidarrRequestStatus) Value() (driver.Value, error) {
}
type Album struct {
ID pgtype.UUID
Title string
SortTitle string
ArtistID pgtype.UUID
ReleaseDate pgtype.Date
Mbid *string
CoverArtPath *string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
CoverArtSource *string
ID pgtype.UUID
Title string
SortTitle string
ArtistID pgtype.UUID
ReleaseDate pgtype.Date
Mbid *string
CoverArtPath *string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
CoverArtSource *string
CoverArtSourcesVersion int32
}
type Artist struct {
ID pgtype.UUID
Name string
SortName string
Mbid *string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
ID pgtype.UUID
Name string
SortName string
Mbid *string
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
ArtistThumbPath *string
ArtistFanartPath *string
ArtistArtSource *string
ArtistArtSourcesVersion int32
}
type ArtistSimilarity struct {
@@ -236,6 +241,20 @@ type ContextualLike struct {
SessionID pgtype.UUID
}
type CoverArtProviderSetting struct {
ProviderID string
Enabled bool
ApiKey *string
DisplayOrder int32
CreatedAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type CoverArtSourcesMetum struct {
ID bool
CurrentVersion int32
}
type GeneralLike struct {
UserID pgtype.UUID
TrackID pgtype.UUID
@@ -364,13 +383,14 @@ type PlaylistTrack struct {
}
type ScanRun struct {
ID pgtype.UUID
StartedAt pgtype.Timestamptz
FinishedAt pgtype.Timestamptz
Library []byte
MbidBackfill []byte
CoverEnrich []byte
ErrorMessage *string
ID pgtype.UUID
StartedAt pgtype.Timestamptz
FinishedAt pgtype.Timestamptz
Library []byte
MbidBackfill []byte
CoverEnrich []byte
ErrorMessage *string
ArtistArtEnrich []byte
}
type ScrobbleQueue struct {