feat: Minstrel stops acquiring music and drops Discover
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
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
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>
This commit is contained in:
@@ -7,35 +7,8 @@ package dbq
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const addMBArtistReleaseGroup = `-- name: AddMBArtistReleaseGroup :exec
|
||||
INSERT INTO mb_artist_release_groups (artist_mbid, release_group_mbid)
|
||||
VALUES ($1, $2)
|
||||
ON CONFLICT DO NOTHING
|
||||
`
|
||||
|
||||
type AddMBArtistReleaseGroupParams struct {
|
||||
ArtistMbid string
|
||||
ReleaseGroupMbid string
|
||||
}
|
||||
|
||||
func (q *Queries) AddMBArtistReleaseGroup(ctx context.Context, arg AddMBArtistReleaseGroupParams) error {
|
||||
_, err := q.db.Exec(ctx, addMBArtistReleaseGroup, arg.ArtistMbid, arg.ReleaseGroupMbid)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteMBArtistReleaseGroups = `-- name: DeleteMBArtistReleaseGroups :exec
|
||||
DELETE FROM mb_artist_release_groups WHERE artist_mbid = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteMBArtistReleaseGroups(ctx context.Context, artistMbid string) error {
|
||||
_, err := q.db.Exec(ctx, deleteMBArtistReleaseGroups, artistMbid)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteMBReleasesForGroup = `-- name: DeleteMBReleasesForGroup :exec
|
||||
DELETE FROM mb_releases WHERE release_group_mbid = $1
|
||||
`
|
||||
@@ -46,27 +19,6 @@ func (q *Queries) DeleteMBReleasesForGroup(ctx context.Context, releaseGroupMbid
|
||||
return err
|
||||
}
|
||||
|
||||
const getMBArtist = `-- name: GetMBArtist :one
|
||||
SELECT mbid, name, sort_name, disambiguation, artist_type, country, discography_refreshed_at, created_at, updated_at FROM mb_artists WHERE mbid = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetMBArtist(ctx context.Context, mbid string) (MbArtist, error) {
|
||||
row := q.db.QueryRow(ctx, getMBArtist, mbid)
|
||||
var i MbArtist
|
||||
err := row.Scan(
|
||||
&i.Mbid,
|
||||
&i.Name,
|
||||
&i.SortName,
|
||||
&i.Disambiguation,
|
||||
&i.ArtistType,
|
||||
&i.Country,
|
||||
&i.DiscographyRefreshedAt,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, 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
|
||||
`
|
||||
@@ -165,78 +117,6 @@ func (q *Queries) InsertMBReleaseTrack(ctx context.Context, arg InsertMBReleaseT
|
||||
return err
|
||||
}
|
||||
|
||||
const listMBArtistReleaseGroups = `-- name: ListMBArtistReleaseGroups :many
|
||||
SELECT g.mbid, g.title, g.primary_type, g.secondary_types, g.first_release_date, g.artist_credit, g.releases_refreshed_at, g.created_at, g.updated_at FROM mb_release_groups g
|
||||
JOIN mb_artist_release_groups ag ON ag.release_group_mbid = g.mbid
|
||||
WHERE ag.artist_mbid = $1
|
||||
ORDER BY g.first_release_date = '', g.first_release_date, g.title, g.mbid
|
||||
`
|
||||
|
||||
// An artist's discography, oldest first; undated groups last.
|
||||
func (q *Queries) ListMBArtistReleaseGroups(ctx context.Context, artistMbid string) ([]MbReleaseGroup, error) {
|
||||
rows, err := q.db.Query(ctx, listMBArtistReleaseGroups, artistMbid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []MbReleaseGroup
|
||||
for rows.Next() {
|
||||
var i MbReleaseGroup
|
||||
if err := rows.Scan(
|
||||
&i.Mbid,
|
||||
&i.Title,
|
||||
&i.PrimaryType,
|
||||
&i.SecondaryTypes,
|
||||
&i.FirstReleaseDate,
|
||||
&i.ArtistCredit,
|
||||
&i.ReleasesRefreshedAt,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listMBArtistsDueForRefresh = `-- name: ListMBArtistsDueForRefresh :many
|
||||
SELECT mbid FROM mb_artists
|
||||
WHERE discography_refreshed_at IS NULL OR discography_refreshed_at < $1
|
||||
ORDER BY discography_refreshed_at NULLS FIRST, mbid
|
||||
LIMIT $2
|
||||
`
|
||||
|
||||
type ListMBArtistsDueForRefreshParams struct {
|
||||
Before pgtype.Timestamptz
|
||||
MaxRows int32
|
||||
}
|
||||
|
||||
// Artists whose discography has never been read, or was read before the
|
||||
// cutoff: never-read first, then oldest first.
|
||||
func (q *Queries) ListMBArtistsDueForRefresh(ctx context.Context, arg ListMBArtistsDueForRefreshParams) ([]string, error) {
|
||||
rows, err := q.db.Query(ctx, listMBArtistsDueForRefresh, arg.Before, arg.MaxRows)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []string
|
||||
for rows.Next() {
|
||||
var mbid string
|
||||
if err := rows.Scan(&mbid); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, mbid)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
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
|
||||
@@ -273,53 +153,6 @@ func (q *Queries) ListMBReleaseTracksForGroup(ctx context.Context, releaseGroupM
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const listMBReleasesForGroup = `-- name: ListMBReleasesForGroup :many
|
||||
SELECT mbid, release_group_mbid, title, status, release_date, country, disambiguation, formats, track_count, created_at FROM mb_releases
|
||||
WHERE release_group_mbid = $1
|
||||
ORDER BY status <> 'Official', release_date = '', release_date, title, mbid
|
||||
`
|
||||
|
||||
// Official editions first, then by date; undated last.
|
||||
func (q *Queries) ListMBReleasesForGroup(ctx context.Context, releaseGroupMbid string) ([]MbRelease, error) {
|
||||
rows, err := q.db.Query(ctx, listMBReleasesForGroup, releaseGroupMbid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []MbRelease
|
||||
for rows.Next() {
|
||||
var i MbRelease
|
||||
if err := rows.Scan(
|
||||
&i.Mbid,
|
||||
&i.ReleaseGroupMbid,
|
||||
&i.Title,
|
||||
&i.Status,
|
||||
&i.ReleaseDate,
|
||||
&i.Country,
|
||||
&i.Disambiguation,
|
||||
&i.Formats,
|
||||
&i.TrackCount,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
const markMBArtistDiscographyRefreshed = `-- name: MarkMBArtistDiscographyRefreshed :exec
|
||||
UPDATE mb_artists SET discography_refreshed_at = now() WHERE mbid = $1
|
||||
`
|
||||
|
||||
func (q *Queries) MarkMBArtistDiscographyRefreshed(ctx context.Context, mbid string) error {
|
||||
_, err := q.db.Exec(ctx, markMBArtistDiscographyRefreshed, mbid)
|
||||
return err
|
||||
}
|
||||
|
||||
const markMBReleaseGroupReleasesRefreshed = `-- name: MarkMBReleaseGroupReleasesRefreshed :exec
|
||||
UPDATE mb_release_groups SET releases_refreshed_at = now() WHERE mbid = $1
|
||||
`
|
||||
@@ -329,43 +162,8 @@ func (q *Queries) MarkMBReleaseGroupReleasesRefreshed(ctx context.Context, mbid
|
||||
return err
|
||||
}
|
||||
|
||||
const upsertMBArtist = `-- name: UpsertMBArtist :exec
|
||||
|
||||
INSERT INTO mb_artists (mbid, name, sort_name, disambiguation, artist_type, country)
|
||||
VALUES ($1, $2, $3, $4,
|
||||
$5, $6)
|
||||
ON CONFLICT (mbid) DO UPDATE SET
|
||||
name = EXCLUDED.name,
|
||||
sort_name = EXCLUDED.sort_name,
|
||||
disambiguation = EXCLUDED.disambiguation,
|
||||
artist_type = EXCLUDED.artist_type,
|
||||
country = EXCLUDED.country,
|
||||
updated_at = now()
|
||||
`
|
||||
|
||||
type UpsertMBArtistParams struct {
|
||||
Mbid string
|
||||
Name string
|
||||
SortName string
|
||||
Disambiguation string
|
||||
ArtistType string
|
||||
Country string
|
||||
}
|
||||
|
||||
// The release catalogue read from MusicBrainz.
|
||||
func (q *Queries) UpsertMBArtist(ctx context.Context, arg UpsertMBArtistParams) error {
|
||||
_, err := q.db.Exec(ctx, upsertMBArtist,
|
||||
arg.Mbid,
|
||||
arg.Name,
|
||||
arg.SortName,
|
||||
arg.Disambiguation,
|
||||
arg.ArtistType,
|
||||
arg.Country,
|
||||
)
|
||||
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)
|
||||
@@ -387,8 +185,9 @@ type UpsertMBReleaseGroupParams struct {
|
||||
ArtistCredit string
|
||||
}
|
||||
|
||||
// Leaves releases_refreshed_at alone: re-reading a discography says nothing
|
||||
// about whether the group's track lists are current.
|
||||
// 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,
|
||||
|
||||
Reference in New Issue
Block a user