chore: remove code left from acquisition and Discover suggestions, and uncalled queries
Nothing reached any of it: - MusicBrainz search (artists, albums, songs), artist lookups and the query escaping they used. The release-group lookups the duplicate resolver uses stay. - Release-group covers, and artist-level tags for artists not in the library. - Nine named queries with no caller (CountTracksByArtist went with the previous commit), two of them describing request-progress reporting. The MusicBrainz client's retry and not-found tests now drive the release-group lookup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,14 +81,6 @@ type AlbumCoverProvider interface {
|
||||
FetchAlbumCover(ctx context.Context, ref AlbumRef) ([]byte, error)
|
||||
}
|
||||
|
||||
// ReleaseGroupCoverProvider is an opt-in capability for sources that can
|
||||
// answer by MusicBrainz release group, which is how the release catalogue
|
||||
// names an album before any edition of it is held.
|
||||
type ReleaseGroupCoverProvider interface {
|
||||
AlbumCoverProvider
|
||||
FetchReleaseGroupCover(ctx context.Context, groupMBID string) ([]byte, error)
|
||||
}
|
||||
|
||||
// ArtistArtProvider is an opt-in capability: providers implementing
|
||||
// it can fetch artist images. Returns thumb + fanart atomically at
|
||||
// the JSON metadata step (one round-trip yields both URLs); the two
|
||||
|
||||
@@ -96,13 +96,6 @@ func (p *mbcaaProvider) FetchAlbumCover(ctx context.Context, ref AlbumRef) ([]by
|
||||
return p.fetchFront(ctx, "release", ref.MBID)
|
||||
}
|
||||
|
||||
// FetchReleaseGroupCover retrieves the 500px front cover the Cover Art
|
||||
// Archive chose for a release group: what a search result or a wanted album
|
||||
// shows before any edition of it is held.
|
||||
func (p *mbcaaProvider) FetchReleaseGroupCover(ctx context.Context, groupMBID string) ([]byte, error) {
|
||||
return p.fetchFront(ctx, "release-group", groupMBID)
|
||||
}
|
||||
|
||||
// fetchFront fetches /{entity}/{mbid}/front-500, honouring the rate limit.
|
||||
func (p *mbcaaProvider) fetchFront(ctx context.Context, entity, mbid string) ([]byte, error) {
|
||||
if !p.enabled.Load() {
|
||||
@@ -170,5 +163,3 @@ func (p *mbcaaProvider) TestConnection(ctx context.Context) error {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
var _ ReleaseGroupCoverProvider = (*mbcaaProvider)(nil)
|
||||
|
||||
@@ -166,24 +166,3 @@ func TestNewMBCAAProviderFromConfig_ReplacesRegisteredConfig(t *testing.T) {
|
||||
t.Errorf("cfg.UserAgent = %q, want %q", gotUA, "Minstrel/test-replaced (x)")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMBCAAProvider_FetchReleaseGroupCover_AsksByGroup(t *testing.T) {
|
||||
var path string
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
path = r.URL.Path
|
||||
_, _ = w.Write([]byte("jpeg"))
|
||||
}))
|
||||
defer srv.Close()
|
||||
p := newMBCAAProviderForTest(t, srv.URL)
|
||||
|
||||
body, err := p.FetchReleaseGroupCover(context.Background(), "rg-1")
|
||||
if err != nil || string(body) != "jpeg" {
|
||||
t.Fatalf("body %q, err %v", body, err)
|
||||
}
|
||||
if path != "/release-group/rg-1/front-500" {
|
||||
t.Errorf("path = %q", path)
|
||||
}
|
||||
if _, err := p.FetchReleaseGroupCover(context.Background(), ""); !errors.Is(err, ErrNotFound) {
|
||||
t.Errorf("no id: err = %v, want ErrNotFound", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user