Files
minstrel/internal/db/dbq/catalogue.sql.go
T
bvandeusenandClaude Opus 5.5 55c7497ca7
release / go (push) Successful in 1m54s
release / web (push) Failing after 5s
release / integration (push) Failing after 3m44s
release / govulncheck (push) Successful in 20s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 19s
release / android (push) Canceled after 2m37s
feat: Minstrel stops acquiring music and drops Discover
Minstrel is now a viewer of the library it is pointed at. Finding,
downloading and filing music moves out of it.

Removed from the server:
- the request flow (requests, approval, auto-approve) and the wanted list,
  follows, release profiles and release blocks;
- searching indexers, the download clients, the importer, the album
  lifecycle and missing-file re-acquisition;
- the catalogue's discography, search and art (the MusicBrainz release and
  track-list cache stays, for the duplicate resolver);
- Discover: its suggestions of artists not in the library, snoozes, the
  candidate-artist tag enrichment and its tuning scope;
- writes to acquisition tables from moving the library folder and from
  merging duplicates, the want-list join on Suspect sources, the sealing of
  acquisition credentials, and the release-group lookup only
  re-acquisition used.

Settling a wrong-slot duplicate no longer sets the release aside: the
copies go and their slots show as missing until a good copy is in the
library.

Removed from the web: Admin > Acquisition and Requests, /requests,
/discover, Follow on the artist page, the auto-approve toggle, and the
Collection's wanted-list tabs. The Collection is now the library's health:
an overview, Reports, Duplicates, Suspect sources and Missing files. The
README and docs no longer describe getting music.

The tables stay for now; a later migration drops them. The request
notification kinds and the Android screens are still to go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 20:51:14 -05:00

202 lines
5.5 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: catalogue.sql
package dbq
import (
"context"
)
const deleteMBReleasesForGroup = `-- name: DeleteMBReleasesForGroup :exec
DELETE FROM mb_releases WHERE release_group_mbid = $1
`
// Tracks go with their releases (ON DELETE CASCADE).
func (q *Queries) DeleteMBReleasesForGroup(ctx context.Context, releaseGroupMbid string) error {
_, err := q.db.Exec(ctx, deleteMBReleasesForGroup, releaseGroupMbid)
return err
}
const getMBReleaseGroup = `-- name: GetMBReleaseGroup :one
SELECT mbid, title, primary_type, secondary_types, first_release_date, artist_credit, releases_refreshed_at, created_at, updated_at FROM mb_release_groups WHERE mbid = $1
`
func (q *Queries) GetMBReleaseGroup(ctx context.Context, mbid string) (MbReleaseGroup, error) {
row := q.db.QueryRow(ctx, getMBReleaseGroup, mbid)
var i MbReleaseGroup
err := row.Scan(
&i.Mbid,
&i.Title,
&i.PrimaryType,
&i.SecondaryTypes,
&i.FirstReleaseDate,
&i.ArtistCredit,
&i.ReleasesRefreshedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const insertMBRelease = `-- name: InsertMBRelease :exec
INSERT INTO mb_releases (mbid, release_group_mbid, title, status, release_date, country,
disambiguation, formats, track_count)
VALUES ($1, $2, $3, $4,
$5, $6, $7, $8,
$9)
ON CONFLICT (mbid) DO UPDATE SET
release_group_mbid = EXCLUDED.release_group_mbid,
title = EXCLUDED.title,
status = EXCLUDED.status,
release_date = EXCLUDED.release_date,
country = EXCLUDED.country,
disambiguation = EXCLUDED.disambiguation,
formats = EXCLUDED.formats,
track_count = EXCLUDED.track_count
`
type InsertMBReleaseParams struct {
Mbid string
ReleaseGroupMbid string
Title string
Status string
ReleaseDate string
Country string
Disambiguation string
Formats string
TrackCount int32
}
func (q *Queries) InsertMBRelease(ctx context.Context, arg InsertMBReleaseParams) error {
_, err := q.db.Exec(ctx, insertMBRelease,
arg.Mbid,
arg.ReleaseGroupMbid,
arg.Title,
arg.Status,
arg.ReleaseDate,
arg.Country,
arg.Disambiguation,
arg.Formats,
arg.TrackCount,
)
return err
}
const insertMBReleaseTrack = `-- name: InsertMBReleaseTrack :exec
INSERT INTO mb_release_tracks (release_mbid, medium_position, position, medium_format, number,
title, length_ms, recording_mbid)
VALUES ($1, $2, $3,
$4, $5, $6, $7,
$8)
`
type InsertMBReleaseTrackParams struct {
ReleaseMbid string
MediumPosition int32
Position int32
MediumFormat string
Number string
Title string
LengthMs int32
RecordingMbid string
}
func (q *Queries) InsertMBReleaseTrack(ctx context.Context, arg InsertMBReleaseTrackParams) error {
_, err := q.db.Exec(ctx, insertMBReleaseTrack,
arg.ReleaseMbid,
arg.MediumPosition,
arg.Position,
arg.MediumFormat,
arg.Number,
arg.Title,
arg.LengthMs,
arg.RecordingMbid,
)
return err
}
const listMBReleaseTracksForGroup = `-- name: ListMBReleaseTracksForGroup :many
SELECT t.release_mbid, t.medium_position, t.position, t.medium_format, t.number, t.title, t.length_ms, t.recording_mbid FROM mb_release_tracks t
JOIN mb_releases r ON r.mbid = t.release_mbid
WHERE r.release_group_mbid = $1
ORDER BY t.release_mbid, t.medium_position, t.position
`
func (q *Queries) ListMBReleaseTracksForGroup(ctx context.Context, releaseGroupMbid string) ([]MbReleaseTrack, error) {
rows, err := q.db.Query(ctx, listMBReleaseTracksForGroup, releaseGroupMbid)
if err != nil {
return nil, err
}
defer rows.Close()
var items []MbReleaseTrack
for rows.Next() {
var i MbReleaseTrack
if err := rows.Scan(
&i.ReleaseMbid,
&i.MediumPosition,
&i.Position,
&i.MediumFormat,
&i.Number,
&i.Title,
&i.LengthMs,
&i.RecordingMbid,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const markMBReleaseGroupReleasesRefreshed = `-- name: MarkMBReleaseGroupReleasesRefreshed :exec
UPDATE mb_release_groups SET releases_refreshed_at = now() WHERE mbid = $1
`
func (q *Queries) MarkMBReleaseGroupReleasesRefreshed(ctx context.Context, mbid string) error {
_, err := q.db.Exec(ctx, markMBReleaseGroupReleasesRefreshed, mbid)
return err
}
const upsertMBReleaseGroup = `-- name: UpsertMBReleaseGroup :exec
INSERT INTO mb_release_groups (mbid, title, primary_type, secondary_types, first_release_date, artist_credit)
VALUES ($1, $2, $3, $4::text[],
$5, $6)
ON CONFLICT (mbid) DO UPDATE SET
title = EXCLUDED.title,
primary_type = EXCLUDED.primary_type,
secondary_types = EXCLUDED.secondary_types,
first_release_date = EXCLUDED.first_release_date,
artist_credit = EXCLUDED.artist_credit,
updated_at = now()
`
type UpsertMBReleaseGroupParams struct {
Mbid string
Title string
PrimaryType string
SecondaryTypes []string
FirstReleaseDate string
ArtistCredit string
}
// The release catalogue read from MusicBrainz.
// Leaves releases_refreshed_at alone: only a full read of the group's
// releases and track lists marks it.
func (q *Queries) UpsertMBReleaseGroup(ctx context.Context, arg UpsertMBReleaseGroupParams) error {
_, err := q.db.Exec(ctx, upsertMBReleaseGroup,
arg.Mbid,
arg.Title,
arg.PrimaryType,
arg.SecondaryTypes,
arg.FirstReleaseDate,
arg.ArtistCredit,
)
return err
}