feat: Minstrel no longer talks to Lidarr: its connection, Delete via Lidarr and the unmonitor options are gone, and the track reports are plain quarantine (M502 #5525)
release / govulncheck (push) Successful in 15s
release / web (push) Failing after 17s
release / go (push) Successful in 1m13s
release / integration (push) Successful in 4m56s
release / android (push) Successful in 5m9s
release / Build signed APK (releases and dev) (push) Successful in 5m19s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 15s
release / web (push) Failing after 17s
release / go (push) Successful in 1m13s
release / integration (push) Successful in 4m56s
release / android (push) Successful in 5m9s
release / Build signed APK (releases and dev) (push) Successful in 5m19s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped
Migration 0091 drops lidarr_config and renames the quarantine tables, types, indexes and the history column off the Lidarr name. The Integrations Lidarr card, the Reports "Delete via Lidarr" action, the merge and remove-track unmonitor options, the Lidarr audit actions and error codes go, on the server, web and Android. The README describes acquisition as it is now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
import AcquisitionCard from '#lib/components/AcquisitionCard.svelte';
|
||||
import SearchSettingsCard from '#lib/components/SearchSettingsCard.svelte';
|
||||
import ReacquisitionSettingsCard from '#lib/components/ReacquisitionSettingsCard.svelte';
|
||||
import LidarrSettings from '#lib/components/admin/LidarrSettings.svelte';
|
||||
import SettingsColumns from '#lib/components/settings/SettingsColumns.svelte';
|
||||
|
||||
// Admin › Acquisition (#5607): how Minstrel gets music. Where it searches
|
||||
// and what downloads, how it searches and what it takes, what happens to
|
||||
// a file that goes missing, and the optional Lidarr connection.
|
||||
// and what downloads, how it searches and what it takes, and what happens
|
||||
// to a file that goes missing.
|
||||
</script>
|
||||
|
||||
<svelte:head><title>{pageTitle('Admin · Acquisition')}</title></svelte:head>
|
||||
@@ -22,6 +21,5 @@
|
||||
{/snippet}
|
||||
{#snippet side()}
|
||||
<div id="reacquisition"><ReacquisitionSettingsCard /></div>
|
||||
<LidarrSettings />
|
||||
{/snippet}
|
||||
</SettingsColumns>
|
||||
|
||||
@@ -43,10 +43,9 @@
|
||||
|
||||
let sweeping = $state(false);
|
||||
let dismissing = $state<string | null>(null);
|
||||
// Per group: which copy to keep (defaults to the proposed survivor), whether to
|
||||
// unmonitor the removed copies in Lidarr, and the two-click confirm.
|
||||
// Per group: which copy to keep (defaults to the proposed survivor) and the
|
||||
// two-click confirm.
|
||||
let keepChoice = $state<Record<string, string>>({});
|
||||
let unmonitorChoice = $state<Record<string, boolean>>({});
|
||||
let confirmingMerge = $state<string | null>(null);
|
||||
let merging = $state<string | null>(null);
|
||||
|
||||
@@ -116,14 +115,8 @@
|
||||
confirmingMerge = null;
|
||||
merging = group.id;
|
||||
try {
|
||||
const result = await mergeDuplicateGroup(group.id, {
|
||||
survivor_track_id: keeperOf(group),
|
||||
unmonitor: unmonitorChoice[group.id] ?? false
|
||||
});
|
||||
const result = await mergeDuplicateGroup(group.id, { survivor_track_id: keeperOf(group) });
|
||||
pushToast(`Merged. Removed ${fileCountLabel(result.removed_paths.length)}.`);
|
||||
if (result.lidarr_unmonitor_failed) {
|
||||
pushToast("Merged, but Lidarr couldn't be told to stop monitoring the removed copies.", 'error');
|
||||
}
|
||||
query.refetch();
|
||||
} catch (e: unknown) {
|
||||
pushToast(errMessage(e), 'error');
|
||||
@@ -261,30 +254,18 @@
|
||||
{:else}
|
||||
<ul class="divide-y divide-border rounded-lg border border-border bg-surface">
|
||||
{#each activity as item (item.id)}
|
||||
{@const removed = item.details.removed ?? []}
|
||||
<li class="space-y-1 px-4 py-3 text-sm" data-testid="resolved-item">
|
||||
{#if item.action === 'duplicate_merge'}
|
||||
{@const removed = item.details.removed ?? []}
|
||||
<p class="text-text-primary">
|
||||
Kept <span class="font-mono text-xs">{basename(item.details.survivor_path ?? '')}</span>
|
||||
{#if item.details.survivor_reason}
|
||||
<span class="text-text-secondary">({item.details.survivor_reason})</span>
|
||||
{/if}
|
||||
and removed {fileCountLabel(removed.length)}.
|
||||
</p>
|
||||
{#each removed as r (r.track_id)}
|
||||
<p class="truncate font-mono text-xs text-text-muted" title={r.file_path}>{r.file_path}</p>
|
||||
{/each}
|
||||
{:else}
|
||||
<p class="text-text-primary">
|
||||
Lidarr now monitors {item.details.to_release ?? 'another release'} of
|
||||
{item.details.album_title ?? 'an album'}{item.details.artist_name
|
||||
? ` by ${item.details.artist_name}`
|
||||
: ''}, which lists each song once.
|
||||
</p>
|
||||
{#if item.details.from_release}
|
||||
<p class="text-xs text-text-secondary">Was {item.details.from_release}.</p>
|
||||
<p class="text-text-primary">
|
||||
Kept <span class="font-mono text-xs">{basename(item.details.survivor_path ?? '')}</span>
|
||||
{#if item.details.survivor_reason}
|
||||
<span class="text-text-secondary">({item.details.survivor_reason})</span>
|
||||
{/if}
|
||||
{/if}
|
||||
and removed {fileCountLabel(removed.length)}.
|
||||
</p>
|
||||
{#each removed as r (r.track_id)}
|
||||
<p class="truncate font-mono text-xs text-text-muted" title={r.file_path}>{r.file_path}</p>
|
||||
{/each}
|
||||
<p class="text-xs text-text-muted">{relativeTime(item.created_at)}</p>
|
||||
</li>
|
||||
{/each}
|
||||
@@ -412,14 +393,6 @@
|
||||
The copy marked Keep stays. The other {fileCountLabel(group.members.length - 1)} will be
|
||||
deleted from disk, and their likes, plays and playlist entries move to the copy kept.
|
||||
</p>
|
||||
<label class="flex items-center gap-2 text-text-secondary">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={unmonitorChoice[group.id] ?? false}
|
||||
onchange={(e) => (unmonitorChoice[group.id] = e.currentTarget.checked)}
|
||||
/>
|
||||
Tell Lidarr to stop monitoring the removed copies, so it doesn't download them again
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs text-text-secondary underline hover:text-text-primary"
|
||||
|
||||
@@ -282,10 +282,7 @@ describe('admin duplicates', () => {
|
||||
expect(text(screen.getByTestId('merge-confirm'))).toContain('The other 1 file will be deleted from disk');
|
||||
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove 1 file and merge' }));
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', {
|
||||
survivor_track_id: 'www-01',
|
||||
unmonitor: false
|
||||
});
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', { survivor_track_id: 'www-01' });
|
||||
});
|
||||
|
||||
test('choosing another copy to keep sends that copy', async () => {
|
||||
@@ -296,10 +293,7 @@ describe('admin duplicates', () => {
|
||||
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Merge…' }));
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove 1 file and merge' }));
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', {
|
||||
survivor_track_id: 'www-02',
|
||||
unmonitor: false
|
||||
});
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', { survivor_track_id: 'www-02' });
|
||||
});
|
||||
|
||||
test('Cancel disarms the merge', async () => {
|
||||
@@ -331,9 +325,7 @@ describe('admin duplicates', () => {
|
||||
expect(dismissDuplicateGroup).toHaveBeenCalledWith('g-1');
|
||||
});
|
||||
|
||||
// Release changes stopped with Lidarr (M502), but the ones made before stay
|
||||
// in the history.
|
||||
test('Resolved automatically lists merges and past release changes', async () => {
|
||||
test('Resolved automatically lists the merges the resolver made', async () => {
|
||||
renderWith(response(), [
|
||||
{
|
||||
id: 'a-1',
|
||||
@@ -344,23 +336,11 @@ describe('admin duplicates', () => {
|
||||
survivor_reason: 'the copy that is not a video rip',
|
||||
removed: [{ track_id: 't-2', file_path: '/music/Gorillaz/Humanz (2017)/03 - Saturnz Barz (Official Video).mp3' }]
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'a-2',
|
||||
action: 'lidarr_release_change',
|
||||
created_at: ago(2 * HOUR),
|
||||
details: {
|
||||
album_title: 'Humanz',
|
||||
artist_name: 'Gorillaz',
|
||||
from_release: '14x12" Vinyl, Digital Media (68 tracks)',
|
||||
to_release: 'Digital Media (40 tracks)'
|
||||
}
|
||||
}
|
||||
]);
|
||||
await fireEvent.click(screen.getByRole('tab', { name: /resolved automatically/i }));
|
||||
const items = screen.getAllByTestId('resolved-item').map(text);
|
||||
expect(items[0]).toContain('Kept 03 - Saturnz Barz.mp3 (the copy that is not a video rip) and removed 1 file.');
|
||||
expect(items[1]).toContain('Lidarr now monitors Digital Media (40 tracks) of Humanz by Gorillaz');
|
||||
expect(screen.queryByTestId('duplicate-group')).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -378,7 +358,7 @@ describe('admin duplicates', () => {
|
||||
await fireEvent.click(screen.getAllByRole('radio')[1]);
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Merge…' }));
|
||||
await fireEvent.click(screen.getByRole('button', { name: 'Remove 1 file and merge' }));
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', { survivor_track_id: 'www-02', unmonitor: false });
|
||||
expect(mergeDuplicateGroup).toHaveBeenCalledWith('g-1', { survivor_track_id: 'www-02' });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { pageTitle } from '#lib/branding.js';
|
||||
import { Music2, CheckCircle2, Trash2, Cloud, Play, Copy, ChevronRight } from 'lucide-svelte';
|
||||
import { Music2, CheckCircle2, Trash2, Play, Copy, ChevronRight } from 'lucide-svelte';
|
||||
import { useQueryClient } from '@tanstack/svelte-query';
|
||||
import RowActionsMenu, { type RowAction } from '#lib/components/RowActionsMenu.svelte';
|
||||
import TabStrip from '#lib/components/TabStrip.svelte';
|
||||
@@ -11,8 +11,7 @@
|
||||
createQuarantineActionsQuery,
|
||||
resolveQuarantine,
|
||||
resolvePlaybackError,
|
||||
deleteQuarantineFile,
|
||||
deleteQuarantineViaLidarr
|
||||
deleteQuarantineFile
|
||||
} from '#lib/api/admin.js';
|
||||
import { qk } from '#lib/api/queries.js';
|
||||
import { errMessage } from '#lib/api/errors.js';
|
||||
@@ -28,7 +27,7 @@
|
||||
mergeReports,
|
||||
type ReportRow
|
||||
} from '#lib/admin/reports.js';
|
||||
import type { LidarrQuarantineReason } from '#lib/api/types.js';
|
||||
import type { QuarantineReason } from '#lib/api/types.js';
|
||||
|
||||
// Admin › Reports (#5606): every broken track in one queue, whether a
|
||||
// listener flagged it or it failed to play on a client, one row per track
|
||||
@@ -128,30 +127,6 @@
|
||||
await refresh();
|
||||
}
|
||||
|
||||
let deleteLidarrId = $state<string | null>(null);
|
||||
let deleteLidarrInput = $state('');
|
||||
let deleteLidarrError = $state<string | null>(null);
|
||||
const deleteLidarrRow = $derived(deleteLidarrId ? (rows.find((r) => r.track_id === deleteLidarrId) ?? null) : null);
|
||||
|
||||
function openDeleteLidarr(r: ReportRow) {
|
||||
deleteLidarrId = r.track_id;
|
||||
deleteLidarrInput = '';
|
||||
deleteLidarrError = null;
|
||||
}
|
||||
|
||||
async function confirmDeleteLidarr(r: ReportRow) {
|
||||
if (deleteLidarrInput.trim() !== 'DELETE') return;
|
||||
try {
|
||||
await deleteQuarantineViaLidarr(r.track_id);
|
||||
deleteLidarrId = null;
|
||||
pushToast(`Asked Lidarr to remove "${r.album}"`);
|
||||
await refresh();
|
||||
} catch (e) {
|
||||
// The modal stays open with the failure beside the album named.
|
||||
deleteLidarrError = errMessage(e);
|
||||
}
|
||||
}
|
||||
|
||||
function actionsFor(r: ReportRow): { primary: RowAction; secondary: RowAction[] } {
|
||||
return {
|
||||
primary: { icon: CheckCircle2, label: 'Resolve', ariaLabel: `Resolve ${r.title}`, onclick: () => onResolve(r) },
|
||||
@@ -164,19 +139,7 @@
|
||||
ariaLabel: `Delete file for ${r.title}`,
|
||||
danger: true,
|
||||
onclick: () => (deleteFileId = r.track_id)
|
||||
},
|
||||
// A local-only track has no Lidarr album to remove.
|
||||
...(r.lidarr_album_mbid
|
||||
? [
|
||||
{
|
||||
icon: Cloud,
|
||||
label: 'Delete via Lidarr',
|
||||
ariaLabel: `Delete via Lidarr for ${r.title}`,
|
||||
danger: true,
|
||||
onclick: () => openDeleteLidarr(r)
|
||||
}
|
||||
]
|
||||
: [])
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
@@ -234,7 +197,7 @@
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-1.5" data-testid="report-kinds">
|
||||
{#each Object.entries(r.reason_counts) as [reason, n] (reason)}
|
||||
<span class="pill">{n}× {REASON_LABELS[reason as LidarrQuarantineReason] ?? reason}</span>
|
||||
<span class="pill">{n}× {REASON_LABELS[reason as QuarantineReason] ?? reason}</span>
|
||||
{/each}
|
||||
{#each errorCounts(r) as [kind, n] (kind)}
|
||||
<span class="pill pill-error">{n}× {ERROR_LABELS[kind] ?? kind}</span>
|
||||
@@ -321,41 +284,6 @@
|
||||
{/if}
|
||||
</Modal>
|
||||
|
||||
<Modal title="Delete via Lidarr?" open={deleteLidarrRow !== null} onClose={() => (deleteLidarrId = null)}>
|
||||
{#if deleteLidarrRow}
|
||||
<p class="-mt-2 text-sm text-text-secondary">
|
||||
Lidarr removes the whole album <em class="font-medium text-text-primary">{deleteLidarrRow.album}</em> by
|
||||
{deleteLidarrRow.artist}, files included, and won't import it again. Type <strong>DELETE</strong> to confirm.
|
||||
</p>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={deleteLidarrInput}
|
||||
placeholder="DELETE"
|
||||
aria-label="Type DELETE to confirm"
|
||||
class="mt-3 w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-sm text-text-primary placeholder:text-text-muted focus:outline-hidden focus:ring-2 focus:ring-accent"
|
||||
/>
|
||||
{#if deleteLidarrError}
|
||||
<p class="mt-3 text-sm text-error-fg" data-testid="delete-lidarr-error">{deleteLidarrError}</p>
|
||||
{/if}
|
||||
<div class="mt-5 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-md border border-border px-3 py-1.5 text-sm text-text-secondary hover:text-text-primary"
|
||||
onclick={() => (deleteLidarrId = null)}>Cancel</button
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Confirm delete via Lidarr"
|
||||
disabled={deleteLidarrInput.trim() !== 'DELETE'}
|
||||
class="inline-flex items-center gap-1 rounded-md bg-action-destructive px-3 py-1.5 text-sm text-action-fg disabled:cursor-not-allowed disabled:opacity-50"
|
||||
onclick={() => confirmDeleteLidarr(deleteLidarrRow!)}
|
||||
>
|
||||
<Cloud size={14} strokeWidth={2} /> Delete via Lidarr
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
.pill {
|
||||
display: inline-flex;
|
||||
|
||||
@@ -9,8 +9,7 @@ vi.mock('#lib/api/admin.js', () => ({
|
||||
createQuarantineActionsQuery: vi.fn(),
|
||||
resolveQuarantine: vi.fn().mockResolvedValue({}),
|
||||
resolvePlaybackError: vi.fn().mockResolvedValue({}),
|
||||
deleteQuarantineFile: vi.fn().mockResolvedValue({}),
|
||||
deleteQuarantineViaLidarr: vi.fn().mockResolvedValue({})
|
||||
deleteQuarantineFile: vi.fn().mockResolvedValue({})
|
||||
}));
|
||||
vi.mock('#lib/player/store.svelte.js', () => ({ playRadio: vi.fn() }));
|
||||
|
||||
@@ -32,7 +31,6 @@ const flagged: AdminQuarantineRow = {
|
||||
artist_name: 'Boards of Canada',
|
||||
album_title: 'Geogaddi',
|
||||
album_id: 'al1',
|
||||
lidarr_album_mbid: 'rg1',
|
||||
report_count: 1,
|
||||
latest_at: hoursAgo(5),
|
||||
reason_counts: { bad_rip: 1 },
|
||||
@@ -99,13 +97,11 @@ describe('/admin/reports', () => {
|
||||
expect(resolvePlaybackError).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('Delete via Lidarr is offered only for an album Lidarr holds, and on a phone it is in the row menu', async () => {
|
||||
test('on a phone the row's other actions are in its menu', async () => {
|
||||
setup([flagged], [failure('e2', 't2', 'Intro', 2)]);
|
||||
expect(screen.getByRole('button', { name: /delete via lidarr for roygbiv/i })).toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: /delete via lidarr for intro/i })).toBeNull();
|
||||
const roygbiv = screen.getAllByTestId('report-row').find((r) => r.textContent?.includes('Roygbiv'))!;
|
||||
await fireEvent.click(within(roygbiv).getByRole('button', { name: /more actions/i }));
|
||||
expect(within(screen.getByRole('menu')).getByText('Delete via Lidarr')).toBeInTheDocument();
|
||||
expect(within(screen.getByRole('menu')).getByText('Delete file')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('details show who flagged it, who it failed for, and the file', async () => {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// is a reason to look, not proof, so each row says what was done and offers
|
||||
// the undo: "This one is fine" lets the track back for good. A rip's album
|
||||
// stays wanted for a clean copy, searched for weekly and filed over the rip
|
||||
// when it comes (#5524, which took over #5447's Lidarr search).
|
||||
// when it comes (#5524).
|
||||
|
||||
const queryStore = createSuspectSourcesQuery();
|
||||
const query = $derived($queryStore);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
);
|
||||
|
||||
// Fetch every track for the artist (the server already honours per-user
|
||||
// lidarr_quarantine) and start the queue, in the server's order for Play
|
||||
// quarantine) and start the queue, in the server's order for Play
|
||||
// and shuffled for Shuffle. Bypassed when the artist has nothing to play.
|
||||
let isStartingPlay = $state(false);
|
||||
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
let { children } = $props<{ children: import('svelte').Snippet }>();
|
||||
|
||||
// The Collection (M502, #5572): what the library holds and wants, and what
|
||||
// Minstrel is fetching for it. Web-only and admin-only. Shaped like Lidarr
|
||||
// so a person moving from it finds their way: the catalogue of artists is
|
||||
// the main section, and the sections down the left show state. The
|
||||
// Minstrel is fetching for it. Web-only and admin-only. The catalogue of
|
||||
// artists is the main section, and the sections down the left show state. The
|
||||
// catalogue's first page carries every section's count; the Catalogue
|
||||
// shares it, so this costs no extra request there.
|
||||
const artistsStore = createWantArtistsQuery();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { useQueryClient } from '@tanstack/svelte-query';
|
||||
import { createMyQuarantineQuery, unflagTrack } from '#lib/api/quarantine.js';
|
||||
import { qk } from '#lib/api/queries.js';
|
||||
import type { LidarrQuarantineMineRow, LidarrQuarantineReason } from '#lib/api/types.js';
|
||||
import type { QuarantineMineRow, QuarantineReason } from '#lib/api/types.js';
|
||||
import ApiErrorBanner from '#lib/components/ApiErrorBanner.svelte';
|
||||
import { coverUrl } from '#lib/media/covers.js';
|
||||
import { relativeTime } from '#lib/utils/relativeTime.js';
|
||||
@@ -12,9 +12,9 @@
|
||||
const client = useQueryClient();
|
||||
const queryStore = createMyQuarantineQuery();
|
||||
const query = $derived($queryStore);
|
||||
const rows = $derived((query.data ?? []) as LidarrQuarantineMineRow[]);
|
||||
const rows = $derived((query.data ?? []) as QuarantineMineRow[]);
|
||||
|
||||
const REASON_LABELS: Record<LidarrQuarantineReason, string> = {
|
||||
const REASON_LABELS: Record<QuarantineReason, string> = {
|
||||
bad_rip: 'Bad rip',
|
||||
wrong_file: 'Wrong file',
|
||||
wrong_tags: 'Wrong tags',
|
||||
|
||||
@@ -9,9 +9,9 @@ vi.mock('#lib/api/quarantine.js', () => ({
|
||||
|
||||
import HiddenPage from './+page.svelte';
|
||||
import { createMyQuarantineQuery, unflagTrack } from '#lib/api/quarantine.js';
|
||||
import type { LidarrQuarantineMineRow } from '#lib/api/types.js';
|
||||
import type { QuarantineMineRow } from '#lib/api/types.js';
|
||||
|
||||
const baseRow: LidarrQuarantineMineRow = {
|
||||
const baseRow: QuarantineMineRow = {
|
||||
track_id: 't1',
|
||||
reason: 'bad_rip',
|
||||
notes: 'crackles',
|
||||
|
||||
Reference in New Issue
Block a user