fix: an album holding every track of an edition, and more besides, is that release group (M502 #5569)
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m19s
release / go (push) Successful in 1m40s
release / integration (push) Successful in 5m15s
release / android (push) Successful in 5m23s
release / Build signed APK (releases and dev) (push) Successful in 5m30s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m19s
release / go (push) Successful in 1m40s
release / integration (push) Successful in 5m15s
release / android (push) Successful in 5m23s
release / Build signed APK (releases and dev) (push) Successful in 5m30s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
Savant's "Void" folder holds all 23 tracks of the VOID (DLC) edition plus 20 more, and was refused at 23 of 43. A whole edition of three or more tracks now matches whatever else the folder holds; singles and two-track releases still need most of the album's tracks, since many albums hold their songs. Matcher version 4 retries the refusals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,8 @@ const libraryMatchBatch = 25
|
||||
// 1 tags, release, discography and search, checked by title and length
|
||||
// 2 titles alone under the album's own name; a refusal names the track
|
||||
// 3 a second copy of a track counts once; joining words count for nothing
|
||||
const libraryMatcher = 3
|
||||
// 4 an album holding every track of an edition, and more, is that group
|
||||
const libraryMatcher = 4
|
||||
|
||||
// listLibrary puts the library's albums on the wanted list as held, once
|
||||
// (operator, 2026-10-10: "make a record saying that the import has
|
||||
|
||||
@@ -277,9 +277,12 @@ func TestTrackAgreement(t *testing.T) {
|
||||
if len(copies) != 2 {
|
||||
t.Errorf("a second copy of a track is read once: %+v", copies)
|
||||
}
|
||||
if agrees(3, 4) || !agrees(4, 5) || agrees(0, 0) {
|
||||
if agrees(3, 4, 0) || !agrees(4, 5, 0) || agrees(0, 0, 0) {
|
||||
t.Error("agrees: 80% of the album's tracks, and an album has tracks")
|
||||
}
|
||||
if !agrees(23, 43, 23) || agrees(2, 10, 2) || agrees(22, 43, 23) {
|
||||
t.Error("agrees: a whole edition of three or more tracks, with more besides")
|
||||
}
|
||||
}
|
||||
|
||||
// A refusal by an older matcher is matched again once the matching improves,
|
||||
|
||||
@@ -170,9 +170,12 @@ func minutes(ms int) string {
|
||||
return fmt.Sprintf("%d:%02d", sec/60, sec%60)
|
||||
}
|
||||
|
||||
// agrees: enough of the album's tracks agree for the edition to be it.
|
||||
func agrees(n, tracks int) bool {
|
||||
return tracks > 0 && n*10 >= tracks*matchAgreement
|
||||
// agrees: enough of the album's tracks agree for the edition to be it, or
|
||||
// the album holds every track of the edition and more besides (a folder
|
||||
// with the deluxe edition and its demos). A single or a two-track release
|
||||
// is not taken on containment: too many albums hold its songs.
|
||||
func agrees(n, tracks, edition int) bool {
|
||||
return tracks > 0 && (n*10 >= tracks*matchAgreement || (edition >= 3 && n == edition))
|
||||
}
|
||||
|
||||
// sameTitle: the same words, not merely one holding the other. "And",
|
||||
@@ -243,7 +246,7 @@ func (s *Service) matchAlbum(ctx context.Context, a dbq.ListAlbumsToMatchRow, tr
|
||||
if err := check(discography); err != nil {
|
||||
return albumMatch{}, err
|
||||
}
|
||||
if !agrees(bestN, len(tracks)) {
|
||||
if !agrees(bestN, len(tracks), bestEdition) {
|
||||
found, err := s.searchCandidates(ctx, a)
|
||||
if err != nil {
|
||||
return albumMatch{}, err
|
||||
@@ -252,7 +255,7 @@ func (s *Service) matchAlbum(ctx context.Context, a dbq.ListAlbumsToMatchRow, tr
|
||||
return albumMatch{}, err
|
||||
}
|
||||
}
|
||||
if agrees(bestN, len(tracks)) {
|
||||
if agrees(bestN, len(tracks), bestEdition) {
|
||||
best.OK = true
|
||||
return best, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user