fix: same-titled albums of two release groups are two albums, and a missing track with no disc is on disc 1
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m30s
release / integration (push) Successful in 5m0s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m30s
release / integration (push) Successful in 5m0s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m9s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
The scanner found an album by artist and title alone, so Weezer's six self-titled albums (1994–2026) were one 118-track row and their merges, wants and upgrades counted them as one. A same-named row whose release group is known and differs from the file's is now another album; tagReadVersion 7 re-reads the library so existing tracks move to their own rows. WantHoldings compared discs with IS NOT DISTINCT FROM, so a missing track 6 with no disc was never covered by a present disc 1 track 6. Air's Love 2 stayed wanted and was downloaded again for nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -72,17 +72,27 @@ func (q *Queries) DeleteAlbumIfEmpty(ctx context.Context, id pgtype.UUID) (Delet
|
||||
}
|
||||
|
||||
const getAlbumByArtistAndTitle = `-- name: GetAlbumByArtistAndTitle :one
|
||||
SELECT id, title, sort_title, artist_id, release_date, mbid, cover_art_path, created_at, updated_at, cover_art_source, cover_art_sources_version, release_group_mbid FROM albums WHERE artist_id = $1 AND title = $2 LIMIT 1
|
||||
SELECT id, title, sort_title, artist_id, release_date, mbid, cover_art_path, created_at, updated_at, cover_art_source, cover_art_sources_version, release_group_mbid FROM albums
|
||||
WHERE artist_id = $1 AND title = $2
|
||||
AND ($3::text IS NULL OR release_group_mbid IS NULL
|
||||
OR release_group_mbid = $3)
|
||||
ORDER BY (release_group_mbid IS NOT DISTINCT FROM $3) DESC, id
|
||||
LIMIT 1
|
||||
`
|
||||
|
||||
type GetAlbumByArtistAndTitleParams struct {
|
||||
ArtistID pgtype.UUID
|
||||
Title string
|
||||
ArtistID pgtype.UUID
|
||||
Title string
|
||||
ReleaseGroupMbid *string
|
||||
}
|
||||
|
||||
// Scanner uses this for the no-mbid dedupe path: resolve-or-create.
|
||||
// Scanner uses this for the no-mbid dedupe path: resolve-or-create. An album
|
||||
// of the same name in another release group is a different album (Weezer's
|
||||
// six self-titled albums shared one row until 2026-10-20), so a row whose
|
||||
// group is known and differs is not returned. A row of the file's own group
|
||||
// comes first, then one with no group yet.
|
||||
func (q *Queries) GetAlbumByArtistAndTitle(ctx context.Context, arg GetAlbumByArtistAndTitleParams) (Album, error) {
|
||||
row := q.db.QueryRow(ctx, getAlbumByArtistAndTitle, arg.ArtistID, arg.Title)
|
||||
row := q.db.QueryRow(ctx, getAlbumByArtistAndTitle, arg.ArtistID, arg.Title, arg.ReleaseGroupMbid)
|
||||
var i Album
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
|
||||
@@ -1572,11 +1572,13 @@ SELECT a.id AS album_id,
|
||||
COALESCE(bool_or(t.missing_since IS NOT NULL AND t.missing_since < $1::timestamptz), false)::bool AS missing_before,
|
||||
-- Missing tracks no track on disk stands in for, by position or
|
||||
-- title. A missing row whose song is back at a new path (#5245) is
|
||||
-- covered; a lost bonus track is not.
|
||||
-- covered; a lost bonus track is not. A track with no disc number is
|
||||
-- on disc 1: Air's Love 2 stayed wanted, and was downloaded again for
|
||||
-- nothing, over a missing track 6 with no disc beside a present 1/6.
|
||||
COUNT(*) FILTER (WHERE t.missing_since IS NOT NULL AND NOT EXISTS (
|
||||
SELECT 1 FROM tracks p
|
||||
WHERE p.album_id = a.id AND p.missing_since IS NULL
|
||||
AND ((p.track_number = t.track_number AND p.disc_number IS NOT DISTINCT FROM t.disc_number)
|
||||
AND ((p.track_number = t.track_number AND COALESCE(p.disc_number, 1) = COALESCE(t.disc_number, 1))
|
||||
OR lower(p.title) = lower(t.title))))::int AS uncovered_missing
|
||||
FROM albums a
|
||||
JOIN tracks t ON t.album_id = a.id
|
||||
|
||||
@@ -36,8 +36,17 @@ WHERE albums.artist_id = $1
|
||||
ORDER BY release_date NULLS LAST, sort_title;
|
||||
|
||||
-- name: GetAlbumByArtistAndTitle :one
|
||||
-- Scanner uses this for the no-mbid dedupe path: resolve-or-create.
|
||||
SELECT * FROM albums WHERE artist_id = $1 AND title = $2 LIMIT 1;
|
||||
-- Scanner uses this for the no-mbid dedupe path: resolve-or-create. An album
|
||||
-- of the same name in another release group is a different album (Weezer's
|
||||
-- six self-titled albums shared one row until 2026-10-20), so a row whose
|
||||
-- group is known and differs is not returned. A row of the file's own group
|
||||
-- comes first, then one with no group yet.
|
||||
SELECT * FROM albums
|
||||
WHERE artist_id = sqlc.arg(artist_id) AND title = sqlc.arg(title)
|
||||
AND (sqlc.narg(release_group_mbid)::text IS NULL OR release_group_mbid IS NULL
|
||||
OR release_group_mbid = sqlc.narg(release_group_mbid))
|
||||
ORDER BY (release_group_mbid IS NOT DISTINCT FROM sqlc.narg(release_group_mbid)) DESC, id
|
||||
LIMIT 1;
|
||||
|
||||
-- name: ListAlbumsByArtist :many
|
||||
SELECT * FROM albums WHERE artist_id = $1 ORDER BY release_date NULLS LAST, sort_title;
|
||||
|
||||
@@ -146,11 +146,13 @@ SELECT a.id AS album_id,
|
||||
COALESCE(bool_or(t.missing_since IS NOT NULL AND t.missing_since < sqlc.arg(since)::timestamptz), false)::bool AS missing_before,
|
||||
-- Missing tracks no track on disk stands in for, by position or
|
||||
-- title. A missing row whose song is back at a new path (#5245) is
|
||||
-- covered; a lost bonus track is not.
|
||||
-- covered; a lost bonus track is not. A track with no disc number is
|
||||
-- on disc 1: Air's Love 2 stayed wanted, and was downloaded again for
|
||||
-- nothing, over a missing track 6 with no disc beside a present 1/6.
|
||||
COUNT(*) FILTER (WHERE t.missing_since IS NOT NULL AND NOT EXISTS (
|
||||
SELECT 1 FROM tracks p
|
||||
WHERE p.album_id = a.id AND p.missing_since IS NULL
|
||||
AND ((p.track_number = t.track_number AND p.disc_number IS NOT DISTINCT FROM t.disc_number)
|
||||
AND ((p.track_number = t.track_number AND COALESCE(p.disc_number, 1) = COALESCE(t.disc_number, 1))
|
||||
OR lower(p.title) = lower(t.title))))::int AS uncovered_missing
|
||||
FROM albums a
|
||||
JOIN tracks t ON t.album_id = a.id
|
||||
|
||||
Reference in New Issue
Block a user