feat: a held album below the quality you settle for, or holding a video rip, stays wanted for a better copy, and the import replaces the old tracks with their likes and plays carried over (M502 #5524)
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m41s
release / integration (push) Successful in 5m20s
release / android (push) Successful in 5m28s
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 27s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 15s
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m41s
release / integration (push) Successful in 5m20s
release / android (push) Successful in 5m28s
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 27s
release / Verify release artifacts (tag releases only) (push) Skipped
- acquisition_settings.upgrade_until (default High quality lossy, Lidarr's cutoff, note #5527; "" is off), an "Upgrade until" row under Searching. - The wanted worker judges held albums hourly: tier per format from size per second (the scanner records no bitrate), the album's worst. Below the cutoff it is wanted for quality; a video rip among its tracks always. - The schedule searches upgrades weekly, after open wants; a release no better than the copy held is refused ("not_better"). - The import matches each file to the track it would replace (recording, then disc/track) and replaces it when it is a rip or the file is a better tier: over the same path in one rename, or filed beside it and the old track folded in (library.ReplaceTrack: file first, then foldTrackInto). Nothing better: the release is set aside. - Collection › Upgrades (Lidarr's Cutoff Unmet); Suspect sources says when a clean copy was looked for instead of Lidarr's search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -183,6 +183,8 @@ DELETE FROM wants WHERE id = $1;
|
||||
-- artist or album title; total counts every match, past the page.
|
||||
SELECT w.id, w.release_group_mbid, w.artist_mbid, w.artist_name, w.title, w.reason,
|
||||
w.album_id, w.wanted_at, w.fulfilled_at,
|
||||
-- Why a held album is wanted again, and the copy it has (#5524).
|
||||
w.upgrade, w.held_quality,
|
||||
-- A request names an album before the catalogue has read it: the
|
||||
-- catalogue's type and date fill in once it has.
|
||||
COALESCE(NULLIF(w.primary_type, ''), g.primary_type, '')::text AS primary_type,
|
||||
@@ -209,6 +211,7 @@ SELECT w.id, w.release_group_mbid, w.artist_mbid, w.artist_name, w.title, w.reas
|
||||
WHERE CASE sqlc.arg(state)::text
|
||||
WHEN 'all' THEN true
|
||||
WHEN 'held' THEN w.fulfilled_at IS NOT NULL
|
||||
WHEN 'upgrade' THEN w.fulfilled_at IS NOT NULL AND w.upgrade <> ''
|
||||
WHEN 'missing' THEN w.fulfilled_at IS NULL AND w.reason = 'missing'
|
||||
ELSE w.fulfilled_at IS NULL AND w.reason <> 'missing'
|
||||
END
|
||||
@@ -270,6 +273,8 @@ SELECT title, disc_number, track_number, duration_ms, (missing_since IS NOT NULL
|
||||
SELECT COUNT(*) FILTER (WHERE fulfilled_at IS NULL AND reason <> 'missing')::bigint AS wanted,
|
||||
COUNT(*) FILTER (WHERE fulfilled_at IS NULL AND reason = 'missing')::bigint AS missing,
|
||||
COUNT(*) FILTER (WHERE fulfilled_at IS NOT NULL)::bigint AS held,
|
||||
-- Held albums wanted for a better copy (#5524).
|
||||
COUNT(*) FILTER (WHERE fulfilled_at IS NOT NULL AND upgrade <> '')::bigint AS upgrades,
|
||||
COUNT(DISTINCT artist_mbid)::bigint AS artists,
|
||||
-- Library albums waiting to be matched by hand (#5579).
|
||||
(SELECT COUNT(*) FROM library_album_matches m
|
||||
@@ -448,3 +453,44 @@ SELECT a.id, a.title, a.mbid, a.release_group_mbid, ar.name AS artist_name, ar.m
|
||||
UPDATE library_album_matches SET outcome = sqlc.arg(outcome), decided_at = now()
|
||||
WHERE album_id = sqlc.arg(album_id) AND outcome = sqlc.arg(was);
|
||||
|
||||
|
||||
-- Upgrades (#5524). -------------------------------------------------------
|
||||
|
||||
-- name: ListHeldWantFormats :many
|
||||
-- What each held album's copy is made of, for judging whether it is worth
|
||||
-- upgrading: its present tracks grouped by format, with their bytes and
|
||||
-- length summed, and how many are held back as video rips. A held want whose
|
||||
-- album has no track with a length yet has no rows.
|
||||
SELECT w.id AS want_id, w.upgrade, w.held_tier, w.held_quality,
|
||||
lower(t.file_format)::text AS file_format,
|
||||
SUM(t.file_size)::bigint AS bytes,
|
||||
SUM(t.duration_ms)::bigint AS duration_ms,
|
||||
COUNT(*)::int AS tracks,
|
||||
COUNT(*) FILTER (WHERE t.source_verdict = 'suspect')::int AS rips
|
||||
FROM wants w
|
||||
JOIN tracks t ON t.album_id = w.album_id
|
||||
WHERE w.fulfilled_at IS NOT NULL
|
||||
AND t.missing_since IS NULL AND t.duration_ms > 0
|
||||
GROUP BY w.id, lower(t.file_format)
|
||||
ORDER BY w.id;
|
||||
|
||||
-- name: SetWantUpgrades :exec
|
||||
-- Writes the upgrade check's verdicts, one row per want.
|
||||
UPDATE wants w
|
||||
SET upgrade = v.upgrade,
|
||||
held_tier = v.held_tier,
|
||||
held_quality = v.held_quality,
|
||||
upgrade_checked_at = now(),
|
||||
updated_at = CASE WHEN w.upgrade <> v.upgrade THEN now() ELSE w.updated_at END
|
||||
FROM (SELECT unnest(sqlc.arg(ids)::uuid[]) AS id,
|
||||
unnest(sqlc.arg(upgrades)::text[]) AS upgrade,
|
||||
unnest(sqlc.arg(held_tiers)::text[]) AS held_tier,
|
||||
unnest(sqlc.arg(held_qualities)::text[]) AS held_quality) v
|
||||
WHERE w.id = v.id;
|
||||
|
||||
-- name: ClearHeldUpgrades :execrows
|
||||
-- A held want whose album has no track left to judge is not wanted again.
|
||||
UPDATE wants SET upgrade = '', held_tier = '', held_quality = '', upgrade_checked_at = now()
|
||||
WHERE fulfilled_at IS NOT NULL AND upgrade <> ''
|
||||
AND NOT EXISTS (SELECT 1 FROM tracks t
|
||||
WHERE t.album_id = wants.album_id AND t.missing_since IS NULL AND t.duration_ms > 0);
|
||||
|
||||
Reference in New Issue
Block a user