diff --git a/backend/explore/explore.go b/backend/explore/explore.go index d0ef82f..6b9304f 100644 --- a/backend/explore/explore.go +++ b/backend/explore/explore.go @@ -2212,6 +2212,7 @@ func (e *Service) gatherTopCandidates( ArtistType: a.Type, Country: a.Country, InLibrary: a.InLibrary, + LocalID: a.LocalID, }, category: "artist", qualityScore: quality, @@ -2243,6 +2244,7 @@ func (e *Service) gatherTopCandidates( ArtistType: a.Type, Country: a.Country, InLibrary: a.InLibrary, + LocalID: a.LocalID, }, category: "artist", qualityScore: quality, @@ -2275,6 +2277,7 @@ func (e *Service) gatherTopCandidates( PrimaryType: rg.PrimaryType, Year: year, InLibrary: rg.InLibrary, + LocalID: rg.LocalID, }, category: "release_group", qualityScore: quality, @@ -2320,6 +2323,7 @@ func (e *Service) gatherTopCandidates( PrimaryType: rg.PrimaryType, Year: year, InLibrary: rg.InLibrary, + LocalID: rg.LocalID, }, category: "release_group", qualityScore: quality, @@ -2347,6 +2351,7 @@ func (e *Service) gatherTopCandidates( CAAReleaseMBID: r.CAAReleaseMBID, ReleaseName: r.ReleaseName, InLibrary: r.InLibrary, + LocalID: r.LocalID, }, category: "recording", qualityScore: quality, @@ -2403,6 +2408,7 @@ func (e *Service) gatherTopCandidates( CAAReleaseMBID: r.CAAReleaseMBID, ReleaseName: r.ReleaseName, InLibrary: r.InLibrary, + LocalID: r.LocalID, }, category: "recording", qualityScore: quality, @@ -2425,6 +2431,7 @@ func (e *Service) gatherTopCandidates( ArtistType: m.ArtistType, Country: m.Country, InLibrary: m.InLibrary || m.LocalArtistID > 0, + LocalID: m.LocalArtistID, }, category: "artist", qualityScore: quality, @@ -2445,6 +2452,7 @@ func (e *Service) gatherTopCandidates( PrimaryType: m.PrimaryType, Year: year, InLibrary: m.InLibrary || m.LocalReleaseGroupID > 0, + LocalID: m.LocalReleaseGroupID, }, category: "release_group", qualityScore: quality, @@ -2459,6 +2467,7 @@ func (e *Service) gatherTopCandidates( ArtistMBID: m.ArtistMBID, Length: m.Duration, InLibrary: m.InLibrary || m.LocalRecordingID > 0, + LocalID: m.LocalRecordingID, }, category: "recording", qualityScore: quality, diff --git a/backend/explore/types.go b/backend/explore/types.go index a00de9e..7cd2c6c 100644 --- a/backend/explore/types.go +++ b/backend/explore/types.go @@ -41,7 +41,16 @@ type TopResult struct { ReleaseGroupMBID string `json:"releaseGroupMbid,omitempty"` ReleaseName string `json:"releaseName,omitempty"` // Library status — populated from index cross-reference columns. - InLibrary bool `json:"inLibrary"` + // + // LocalID is the one the cards read. It is the local row behind + // this entity — an album, a file, an artist — and it is set and + // cleared by a test against `audio_files`, so it means "there is + // something of mine here". InLibrary is written by the same pass + // but is a one-way ratchet the prune can only clear alongside a + // local id, so it is the weaker of the two and stays for scoring + // (`fwInLibrary`), which is where an approximate answer is fine. + InLibrary bool `json:"inLibrary"` + LocalID int64 `json:"localId,omitempty"` } // MBArtist is a Wails-friendly projection of a MusicBrainz artist. diff --git a/frontend/bindings/yellowjacket/backend/explore/models.ts b/frontend/bindings/yellowjacket/backend/explore/models.ts index 54646db..8af5467 100644 --- a/frontend/bindings/yellowjacket/backend/explore/models.ts +++ b/frontend/bindings/yellowjacket/backend/explore/models.ts @@ -431,8 +431,17 @@ export interface TopResult { /** * Library status — populated from index cross-reference columns. + * + * LocalID is the one the cards read. It is the local row behind + * this entity — an album, a file, an artist — and it is set and + * cleared by a test against `audio_files`, so it means "there is + * something of mine here". InLibrary is written by the same pass + * but is a one-way ratchet the prune can only clear alongside a + * local id, so it is the weaker of the two and stays for scoring + * (`fwInLibrary`), which is where an approximate answer is fine. */ "inLibrary": boolean; + "localId"?: number; } /**