feat(admin): switches for ListenBrainz similarity and MusicBrainz track lists
release / go (push) Successful in 1m50s
release / web (push) Successful in 1m15s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m11s
release / android (push) Successful in 4m33s
release / Build signed APK (push) Successful in 4m40s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 22s
release / Verify release artifacts (tag releases only) (push) Skipped

Both lookups ran with no way to stop them. Admin › Metadata sources now
has an "Other lookups" group with a switch each, both on by default
(lookup_settings, migration 0111). Off, the similarity worker asks
ListenBrainz nothing and still links what it already fetched; the
duplicate resolver gets ErrLookupOff and decides from the track lists it
already has. The setting is backed up, and docs/security.md names the
switches. docs/security.md also says every account but the first needs an
invite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 08:59:25 -05:00
co-authored by Claude Opus 5.5
parent 1942cb39cf
commit 3491cf4c58
24 changed files with 571 additions and 22 deletions
+19 -1
View File
@@ -27,6 +27,7 @@ import (
"git.fabledsword.com/bvandeusen/minstrel/internal/gc"
"git.fabledsword.com/bvandeusen/minstrel/internal/library"
"git.fabledsword.com/bvandeusen/minstrel/internal/logging"
"git.fabledsword.com/bvandeusen/minstrel/internal/lookups"
"git.fabledsword.com/bvandeusen/minstrel/internal/mailer"
"git.fabledsword.com/bvandeusen/minstrel/internal/notifications"
"git.fabledsword.com/bvandeusen/minstrel/internal/playlists"
@@ -195,6 +196,14 @@ func run() error {
logger.Warn("loudness settings: using defaults", "err", loudErr)
}
// Switches for ListenBrainz similarity and MusicBrainz track lists:
// shared by the similarity worker, the duplicate resolver and the admin
// API. A load failure leaves both on, as on a new install.
lookupSettings, lookupErr := lookups.New(ctx, pool)
if lookupErr != nil {
logger.Warn("lookup settings: using defaults", "err", lookupErr)
}
// AcoustID lookup settings: shared by the lookup worker and the
// admin API. A load failure leaves the lookup off.
acoustIDSettings, acoustIDErr := library.NewAcoustIDSettingsService(ctx, pool)
@@ -287,7 +296,9 @@ func run() error {
// Similarity ingest worker: hourly, fetches ListenBrainz similarity for up
// to 5 played tracks and 5 played artists, each re-fetched at most weekly.
// The endpoints are public, so no token is needed.
// An admin can switch it off under Metadata sources.
similarityWorker := similarity.NewWorker(pool, listenbrainz.NewClient(), logger.With("component", "similarity"))
similarityWorker.Enabled = func() bool { return lookupSettings.Get().ListenBrainzSimilarity }
go similarityWorker.Run(ctx)
// Household co-play worker: recomputes artist–artist
@@ -369,7 +380,13 @@ func run() error {
// decide, a few a pass. See internal/library/duplicate_resolve.go.
go library.NewDuplicateResolveWorker(pool, logger.With("component", "duplicate_resolve"),
cfg.Storage.DataDir, fpSettings, library.ResolveSources{
TrackLists: cat.RefreshReleaseGroup, Identify: acoustIDLookup.IdentifyRecordings,
TrackLists: func(ctx context.Context, releaseGroupMBID string) error {
if !lookupSettings.Get().MusicBrainzTrackLists {
return library.ErrLookupOff
}
return cat.RefreshReleaseGroup(ctx, releaseGroupMBID)
},
Identify: acoustIDLookup.IdentifyRecordings,
}).Run(ctx)
// library_changes compactor: daily, deletes
@@ -450,6 +467,7 @@ func run() error {
srv.FingerprintSettings = fpSettings
srv.LoudnessSettings = loudSettings
srv.AcoustIDLookup = acoustIDLookup
srv.LookupSettings = lookupSettings
// The server's own backup: the loop runs the nightly schedule, and the
// admin page starts, tests and configures the same instance.
backups := backup.NewService(pool, logger.With("component", "backup"), buildinfo.Version)