feat(web): every Collection queue can remove the file and keep the track
release / web (push) Failing after 1m28s
release / go (push) Successful in 1m53s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m16s
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 2m13s
release / android (push) Canceled after 2m59s
release / web (push) Failing after 1m28s
release / go (push) Successful in 1m53s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m16s
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 2m13s
release / android (push) Canceled after 2m59s
Reports offers "Remove the file" ahead of "Remove from library": the bad file goes and the track waits in Needs a file, with its likes and plays, for a good copy. Suspect sources gets "Remove this file", and the Duplicates wrong-slot action and its route are named for what they do (remove-files). Their toasts and copy name Needs a file. Missing files becomes Needs a file in the rail, the Collection header and the Overview counts. Each track says why it waits and who removed it, and can be forgotten one at a time or by folder; the list exports as a CSV or copies to the clipboard. The empty state says how a track gets there and how it leaves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,10 +10,10 @@ export type QueueKey = keyof AdminSummary;
|
||||
export type QueueDef = {
|
||||
key: QueueKey;
|
||||
href: string;
|
||||
// How the Overview names a count of them: "2 missing files".
|
||||
// How the Overview names a count of them: "2 tracks need a file".
|
||||
one: string;
|
||||
many: string;
|
||||
// How the Overview's healthy line names an empty one: "no missing files".
|
||||
// How the Overview's healthy line names an empty one: "no tracks waiting for a file".
|
||||
none: string;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ export const QUEUES: QueueDef[] = [
|
||||
{ key: 'reports', href: '/collection/reports', one: 'broken track reported', many: 'broken tracks reported', none: 'reports' },
|
||||
{ key: 'duplicates', href: '/collection/duplicates', one: 'set of duplicates to review', many: 'sets of duplicates to review', none: 'duplicates' },
|
||||
{ key: 'suspect', href: '/collection/suspect-sources', one: 'track from a suspect source', many: 'tracks from suspect sources', none: 'suspect sources' },
|
||||
{ key: 'missing', href: '/collection/missing', one: 'missing file', many: 'missing files', none: 'missing files' }
|
||||
{ key: 'missing', href: '/collection/missing', one: 'track needs a file', many: 'tracks need a file', none: 'tracks waiting for a file' }
|
||||
];
|
||||
|
||||
export function countOf(summary: AdminSummary | undefined, key: QueueKey): number {
|
||||
|
||||
@@ -93,7 +93,8 @@ export type HandledRow = { key: string; title: string; artist: string; what: str
|
||||
|
||||
const ACTION_LABELS: Record<QuarantineActionRow['action'], string> = {
|
||||
resolved: 'Reports cleared',
|
||||
deleted_file: 'File deleted',
|
||||
removed_file: 'File removed, track waits for a good copy',
|
||||
deleted_file: 'Removed from the library',
|
||||
deleted_album: 'Album deleted'
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import type {
|
||||
AdminDuplicatesResponse,
|
||||
DuplicatesView,
|
||||
MergeDuplicateResult,
|
||||
RefetchDuplicateResult,
|
||||
WrongSlotRemoval,
|
||||
ResolvedDuplicatesResponse,
|
||||
AdminPlaybackError,
|
||||
AdminQuarantineRow,
|
||||
@@ -61,6 +61,13 @@ export async function resolveQuarantine(trackID: string): Promise<ActionResult>
|
||||
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/resolve`, {});
|
||||
}
|
||||
|
||||
// Removes the reported file and keeps the track, which waits in Needs a file
|
||||
// for a good copy. Its reports and playback errors are settled with it.
|
||||
export async function removeQuarantineFile(trackID: string): Promise<ActionResult> {
|
||||
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/remove-file`, {});
|
||||
}
|
||||
|
||||
// Removes the track from the library with its file, history and all.
|
||||
export async function deleteQuarantineFile(trackID: string): Promise<ActionResult> {
|
||||
return api.post<ActionResult>(`/api/admin/quarantine/${trackID}/delete-file`, {});
|
||||
}
|
||||
@@ -834,14 +841,15 @@ export async function mergeDuplicateGroup(
|
||||
);
|
||||
}
|
||||
|
||||
// One recording in several of an album's slots: keep the copy whose
|
||||
// title it is, or none (empty keep_track_id), and fetch the album again.
|
||||
export async function refetchDuplicateGroup(
|
||||
// One recording in several of an album's slots: keep the copy whose title it
|
||||
// is, or none (empty keep_track_id). The other copies' files go and their
|
||||
// tracks wait in Needs a file for a good copy.
|
||||
export async function removeWrongSlotFiles(
|
||||
id: string,
|
||||
body: { keep_track_id: string }
|
||||
): Promise<RefetchDuplicateResult> {
|
||||
return api.post<RefetchDuplicateResult>(
|
||||
`/api/admin/library/duplicates/${encodeURIComponent(id)}/refetch`,
|
||||
): Promise<WrongSlotRemoval> {
|
||||
return api.post<WrongSlotRemoval>(
|
||||
`/api/admin/library/duplicates/${encodeURIComponent(id)}/remove-files`,
|
||||
body
|
||||
);
|
||||
}
|
||||
@@ -850,7 +858,7 @@ export async function dismissDuplicateGroup(id: string): Promise<void> {
|
||||
await api.post(`/api/admin/library/duplicates/${encodeURIComponent(id)}/dismiss`, {});
|
||||
}
|
||||
|
||||
// Missing files -----------------------------------------------------
|
||||
// Needs a file ------------------------------------------------------
|
||||
|
||||
export async function listMissingFiles(
|
||||
offset: number = 0,
|
||||
@@ -876,6 +884,16 @@ export function createMissingFilesQuery(offset: number = 0, limit: number = 50)
|
||||
});
|
||||
}
|
||||
|
||||
// Forgets tracks waiting for a file, for good: each goes with its likes, plays
|
||||
// and playlist places. All or nothing; a track whose file is back is refused.
|
||||
export async function forgetMissingTracks(trackIds: string[]): Promise<{ forgotten: number }> {
|
||||
return api.post<{ forgotten: number }>('/api/admin/library/missing/forget', { track_ids: trackIds });
|
||||
}
|
||||
|
||||
// The whole list as a CSV, to hand to whatever finds music. A plain link
|
||||
// downloads it: the session cookie goes with it.
|
||||
export const MISSING_FILES_CSV_URL = '/api/admin/library/missing.csv';
|
||||
|
||||
// Suspect sources --------------------------------------------------
|
||||
|
||||
export const SUSPECT_SOURCES_PAGE_SIZE = 50;
|
||||
@@ -910,6 +928,12 @@ export async function setSuspectVerdict(trackId: string, verdict: SuspectVerdict
|
||||
await api.put(`/api/admin/library/suspect-sources/${encodeURIComponent(trackId)}`, { verdict });
|
||||
}
|
||||
|
||||
// Removes a suspect source's file and keeps its track, which waits in Needs a
|
||||
// file for a clean copy.
|
||||
export async function removeSuspectFile(trackId: string): Promise<void> {
|
||||
await api.post(`/api/admin/library/suspect-sources/${encodeURIComponent(trackId)}/remove`, {});
|
||||
}
|
||||
|
||||
// Notification emails: when the grouped emails go out.
|
||||
export type NotificationEmailSettings = {
|
||||
summary_hour: number;
|
||||
|
||||
@@ -215,7 +215,7 @@ export type AdminPlaybackError = {
|
||||
|
||||
// deleted_album is history: an album removed whole, before Minstrel filed its
|
||||
// own music.
|
||||
export type QuarantineAction = 'resolved' | 'deleted_file' | 'deleted_album';
|
||||
export type QuarantineAction = 'resolved' | 'removed_file' | 'deleted_file' | 'deleted_album';
|
||||
|
||||
export type QuarantineActionRow = {
|
||||
id: string;
|
||||
@@ -247,13 +247,18 @@ export type HomePayload = {
|
||||
you_might_like_artists: ArtistRef[];
|
||||
};
|
||||
|
||||
// Missing files -----------------------------------------------------
|
||||
// Needs a file ------------------------------------------------------
|
||||
|
||||
// One track whose file the scan could not find. The text fields come from the
|
||||
// tracks row rather than the filesystem — the recording is still a known thing
|
||||
// with a history, only its bytes are absent. last_played_at is null for a file
|
||||
// that was never played, which is the signal that separates "worth chasing"
|
||||
// from "let it go".
|
||||
// Which Collection queue a track's file was removed from. A track with none
|
||||
// went missing from disk on its own.
|
||||
export type RemovedFor = 'report' | 'duplicate' | 'suspect';
|
||||
|
||||
// One track waiting for a file. The text fields come from the tracks row
|
||||
// rather than the filesystem — the recording is still a known thing with a
|
||||
// history, only its bytes are absent. last_played_at is null for a file that
|
||||
// was never played, which is the signal that separates "worth chasing" from
|
||||
// "let it go". removed_by is the admin who removed it, null for the duplicate
|
||||
// checker or a file gone from disk.
|
||||
export type AdminMissingTrack = {
|
||||
track_id: string;
|
||||
title: string;
|
||||
@@ -263,6 +268,12 @@ export type AdminMissingTrack = {
|
||||
album_title: string;
|
||||
file_path: string;
|
||||
duration_sec: number;
|
||||
disc_number: number | null;
|
||||
track_number: number | null;
|
||||
recording_mbid: string | null;
|
||||
release_group_mbid: string | null;
|
||||
removed_for: RemovedFor | null;
|
||||
removed_by: string | null;
|
||||
missing_since: string;
|
||||
last_played_at: string | null;
|
||||
};
|
||||
@@ -381,7 +392,7 @@ export type MergeDuplicateResult = {
|
||||
|
||||
// What settling one recording in several slots did. kept_track_id is
|
||||
// null when every copy went.
|
||||
export type RefetchDuplicateResult = {
|
||||
export type WrongSlotRemoval = {
|
||||
kept_track_id: string | null;
|
||||
removed_paths: string[];
|
||||
};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// The Collection's sections, down the left: the overview first, then the
|
||||
// library's health queues. Their counts come from the admin summary and are
|
||||
// accented, as they wait on a person. Missing files counts tracks.
|
||||
// accented, as they wait on a person. Needs a file counts tracks.
|
||||
|
||||
let { summary }: { summary?: AdminSummary } = $props();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
{ href: '/collection/reports', label: 'Reports', attention: countOf(summary, 'reports') },
|
||||
{ href: '/collection/duplicates', label: 'Duplicates', attention: countOf(summary, 'duplicates') },
|
||||
{ href: '/collection/suspect-sources', label: 'Suspect sources', attention: countOf(summary, 'suspect') },
|
||||
{ href: '/collection/missing', label: 'Missing files', attention: countOf(summary, 'missing') }
|
||||
{ href: '/collection/missing', label: 'Needs a file', attention: countOf(summary, 'missing') }
|
||||
]);
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user