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:
@@ -8,7 +8,6 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -173,37 +172,3 @@ func sleep(ctx context.Context, d time.Duration) error {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// luceneSpecial are the characters MusicBrainz's search syntax gives meaning.
|
||||
const luceneSpecial = `+-&|!(){}[]^"~*?:\/`
|
||||
|
||||
// Escape makes text typed by a person safe to put in a search query, so
|
||||
// "AM/FM" or "Moon O)))" searches for what was typed rather than failing to
|
||||
// parse.
|
||||
func Escape(s string) string {
|
||||
var b strings.Builder
|
||||
for _, r := range s {
|
||||
if strings.ContainsRune(luceneSpecial, r) {
|
||||
b.WriteByte('\\')
|
||||
}
|
||||
b.WriteRune(r)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// fieldQuery searches each field for the escaped text.
|
||||
func fieldQuery(text string, fields ...string) string {
|
||||
t := Escape(strings.TrimSpace(text))
|
||||
parts := make([]string, len(fields))
|
||||
for i, f := range fields {
|
||||
parts[i] = f + ":(" + t + ")"
|
||||
}
|
||||
return strings.Join(parts, " OR ")
|
||||
}
|
||||
|
||||
func searchLimit(limit int) string {
|
||||
if limit <= 0 || limit > 100 {
|
||||
limit = 25
|
||||
}
|
||||
return strconv.Itoa(limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user