fix: a release group whose title names a live, remix or demo version is wanted only when the profile allows that version (M502 #5573)
release / govulncheck (push) Successful in 17s
release / web (push) Successful in 1m31s
release / go (push) Successful in 1m51s
release / android (push) Successful in 5m18s
release / integration (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 21s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 17s
release / web (push) Successful in 1m31s
release / go (push) Successful in 1m51s
release / android (push) Successful in 5m18s
release / integration (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 21s
release / Verify release artifacts (tag releases only) (push) Skipped
MusicBrainz types My Chemical Romance's "Common People (Recorded For BBC Radio 1)" as a plain Single, so a studio-only follow wanted it. Passes now reads the title's qualifier (brackets, or after a dash) for the version it names and treats it as a secondary type; a version no type names, an acoustic or instrumental one, no profile passes. The follow check takes off the list an open follow want the rule now refuses. Judge counts bbc, sessions and unplugged as live. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/catalogue"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/musicbrainz"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/release"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/tags"
|
||||
)
|
||||
|
||||
@@ -275,7 +276,13 @@ func (s *Service) applyFollow(ctx context.Context, q *dbq.Queries, f dbq.Follow)
|
||||
wanted := 0
|
||||
for _, g := range groups {
|
||||
judge := (baseline && f.WantExisting) || (!baseline && !g.Seen && s.recent(g.FirstReleaseDate, f.BaselineAt.Time))
|
||||
if judge && Passes(profile, g.PrimaryType, g.SecondaryTypes) {
|
||||
passes := Passes(profile, g.Title, g.PrimaryType, g.SecondaryTypes)
|
||||
if !passes {
|
||||
if err := s.dropRefusedVersion(ctx, q, g.Mbid, g.Title); err != nil {
|
||||
return wanted, err
|
||||
}
|
||||
}
|
||||
if judge && passes {
|
||||
held, err := q.LibraryHoldsReleaseGroup(ctx, dbq.LibraryHoldsReleaseGroupParams{
|
||||
GroupMbid: g.Mbid, Title: g.Title, ArtistMbid: f.ArtistMbid,
|
||||
})
|
||||
@@ -305,6 +312,32 @@ func (s *Service) applyFollow(ctx context.Context, q *dbq.Queries, f dbq.Follow)
|
||||
return wanted, q.MarkFollowChecked(ctx, f.ArtistMbid)
|
||||
}
|
||||
|
||||
// dropRefusedVersion takes off the list a group the follow wanted before
|
||||
// Passes read the version its title names (#5573), while it is still only
|
||||
// wanted: one the operator holds, or wanted for another reason, stays.
|
||||
func (s *Service) dropRefusedVersion(ctx context.Context, q *dbq.Queries, group, title string) error {
|
||||
v, ok := release.VersionInTitle(title)
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
w, err := q.GetWantByReleaseGroup(ctx, group)
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return fmt.Errorf("read want %s: %w", title, err)
|
||||
}
|
||||
if w.Reason != ReasonFollow || w.FulfilledAt.Valid {
|
||||
return nil
|
||||
}
|
||||
if _, err := q.DeleteWant(ctx, w.ID); err != nil {
|
||||
return fmt.Errorf("drop want %s: %w", title, err)
|
||||
}
|
||||
s.logger.Info("wanted: a followed artist's release is another version, taken off the list",
|
||||
"want", title, "version", v.What, "word", v.Word)
|
||||
return nil
|
||||
}
|
||||
|
||||
// recent reports whether a release dated date (MusicBrainz's partial date:
|
||||
// "2026", "2026-10", "2026-10-09", or empty when not yet known) came out no
|
||||
// earlier than NewReleaseGrace before the follow's baseline. A partial date
|
||||
|
||||
Reference in New Issue
Block a user