feat: indexers and download clients you add and configure (M502 #5518)
release / govulncheck (push) Successful in 34s
release / web (push) Successful in 1m13s
release / go (push) Successful in 2m12s
release / integration (push) Successful in 4m6s
release / Build signed APK (releases and dev) (push) Successful in 8m41s
release / android (push) Successful in 9m47s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 59s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 34s
release / web (push) Successful in 1m13s
release / go (push) Successful in 2m12s
release / integration (push) Successful in 4m6s
release / Build signed APK (releases and dev) (push) Successful in 8m41s
release / android (push) Successful in 9m47s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 59s
release / Verify release artifacts (tag releases only) (push) Skipped
Admin → Integrations gains "Indexers and download clients": two lists of
connections the operator adds, Fabled Librarian's model. Nothing is seeded
or copied from Lidarr.
- Indexers: Prowlarr (its native /api/v1/search, which asks every indexer
at once; Prowlarr has no aggregate Torznab feed) and any Torznab feed.
- Download clients: qBittorrent (WebUI v2, with re-login on an expired
session) and FabledExchange, one entry with a switch per job:
downloads (/api/downloads), search (/api/search) and release details
(/api/torrents/{infohash}). All three start on; its key is optional.
- Each entry: enable, name, address, a write-only key or password, Test.
A download client's Test lists its torrents and checks the downloads
folder is visible and writable from Minstrel; an Exchange's Test
reports each job switched on.
- Download clients carry a path mapping (Minstrel's /downloads vs the
client's own name for it); search sources carry searches per hour.
Migration 0079 adds acquisition_services with its CHECKs. Ported from
Fabled Librarian: internal/indexer (Torznab, 429 Retry-After, magnet
redirects), internal/prowlarr, internal/exchange, internal/downloader,
and internal/acquire's one builder per kind, which Test already uses
so a passing Test vouches for the path a grab will take.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import {
|
||||
addAcquisitionService,
|
||||
listAcquisitionServices,
|
||||
type AcquisitionProtocol,
|
||||
type AcquisitionService
|
||||
} from '#lib/api/admin.js';
|
||||
import { errMessage } from '#lib/api/errors.js';
|
||||
import { pushToast } from '#lib/stores/toast.svelte.js';
|
||||
import AcquisitionServiceRow from './AcquisitionServiceRow.svelte';
|
||||
|
||||
// Where Minstrel looks for music and what downloads it (M502 #5518),
|
||||
// Fabled Librarian's model: two lists of connections the operator adds and
|
||||
// configures. Nothing is seeded or copied from Lidarr. A FabledExchange is
|
||||
// one entry under download clients, with a switch for each of its jobs.
|
||||
|
||||
let services = $state<AcquisitionService[] | null>(null);
|
||||
let loadError = $state(false);
|
||||
let adding = $state<'search' | 'download' | null>(null);
|
||||
|
||||
const indexers = $derived((services ?? []).filter((s) => s.kind === 'search'));
|
||||
const clients = $derived((services ?? []).filter((s) => s.kind === 'download'));
|
||||
const searchingExchanges = $derived(
|
||||
clients.filter((s) => s.protocol === 'exchange' && s.serves_search)
|
||||
);
|
||||
const canSearch = $derived(
|
||||
(services ?? []).some(
|
||||
(s) => s.usable && (s.protocol === 'exchange' ? s.serves_search : s.kind === 'search')
|
||||
)
|
||||
);
|
||||
const canFetch = $derived(
|
||||
(services ?? []).some(
|
||||
(s) => s.usable && (s.protocol === 'exchange' ? s.serves_downloads : s.kind === 'download')
|
||||
)
|
||||
);
|
||||
|
||||
const choices: Record<
|
||||
'search' | 'download',
|
||||
{ protocol: AcquisitionProtocol; name: string; note: string }[]
|
||||
> = {
|
||||
search: [
|
||||
{
|
||||
protocol: 'prowlarr',
|
||||
name: 'Prowlarr',
|
||||
note: 'Suggested. Every indexer you have set up in Prowlarr, asked in one search.'
|
||||
},
|
||||
{
|
||||
protocol: 'torznab',
|
||||
name: 'Torznab feed',
|
||||
note: 'Jackett, or a single indexer you point at directly.'
|
||||
}
|
||||
],
|
||||
download: [
|
||||
{
|
||||
protocol: 'qbittorrent',
|
||||
name: 'qBittorrent',
|
||||
note: 'Or anything else that speaks its WebUI.'
|
||||
},
|
||||
{
|
||||
protocol: 'exchange',
|
||||
name: 'FabledExchange',
|
||||
note: 'If you run it: one entry that downloads, searches its DHT index and checks releases. Each job can be switched off.'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
services = await listAcquisitionServices();
|
||||
loadError = false;
|
||||
} catch {
|
||||
loadError = true;
|
||||
}
|
||||
}
|
||||
|
||||
onMount(load);
|
||||
|
||||
async function add(protocol: AcquisitionProtocol) {
|
||||
try {
|
||||
const created = await addAcquisitionService(protocol);
|
||||
adding = null;
|
||||
pushToast(`${created.label} added. Give it an address, test it, then switch it on.`);
|
||||
await load();
|
||||
} catch (e) {
|
||||
pushToast(errMessage(e), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
const addButtonClass =
|
||||
'rounded-md border border-border px-3 py-1.5 text-sm text-text-primary hover:bg-surface-hover ' +
|
||||
'focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-accent';
|
||||
</script>
|
||||
|
||||
{#snippet addMenu(kind: 'search' | 'download', label: string)}
|
||||
{#if adding === kind}
|
||||
<div class="space-y-2" data-testid="add-{kind}">
|
||||
{#each choices[kind] as choice (choice.protocol)}
|
||||
<button
|
||||
type="button"
|
||||
class="block w-full rounded-lg border border-border px-4 py-3 text-left hover:bg-surface-hover
|
||||
focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-accent"
|
||||
onclick={() => add(choice.protocol)}
|
||||
>
|
||||
<span class="block text-sm font-medium text-text-primary">{choice.name}</span>
|
||||
<span class="block text-xs text-text-secondary">{choice.note}</span>
|
||||
</button>
|
||||
{/each}
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm text-text-secondary underline hover:no-underline"
|
||||
onclick={() => (adding = null)}>Cancel</button
|
||||
>
|
||||
</div>
|
||||
{:else}
|
||||
<button type="button" class={addButtonClass} onclick={() => (adding = kind)}>{label}</button>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
<section
|
||||
class="space-y-5 rounded-xl border border-border bg-surface p-5"
|
||||
data-testid="acquisition-card"
|
||||
>
|
||||
<div>
|
||||
<h3 class="font-display text-lg font-medium text-text-primary">
|
||||
Indexers and download clients
|
||||
</h3>
|
||||
<p class="mt-1 text-sm text-text-secondary">
|
||||
Two jobs, kept apart: something to search with, and something to download with. Minstrel
|
||||
speaks Prowlarr, Torznab and the qBittorrent WebUI, so a stock setup is a complete one.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{#if loadError}
|
||||
<p class="text-sm text-action-destructive">
|
||||
Couldn't load indexers and download clients.
|
||||
<button type="button" class="underline hover:no-underline" onclick={load}>Try again</button>
|
||||
</p>
|
||||
{:else if services === null}
|
||||
<p class="text-sm text-text-secondary">Loading indexers and download clients…</p>
|
||||
{:else}
|
||||
<p class="text-sm" data-testid="acquisition-health">
|
||||
{#if !canFetch}
|
||||
<span class="text-action-destructive">
|
||||
No download client is switched on, so nothing can be downloaded.
|
||||
</span>
|
||||
{:else if !canSearch}
|
||||
<span class="text-action-destructive">
|
||||
No indexer is switched on, so nothing new can be found.
|
||||
</span>
|
||||
{:else}
|
||||
<span class="text-text-secondary">Music can be searched for and downloaded.</span>
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
<div class="space-y-3" data-testid="indexers">
|
||||
<div>
|
||||
<h4 class="text-sm font-medium text-text-primary">Indexers: where music is looked for</h4>
|
||||
<p class="text-xs text-text-secondary">
|
||||
Every indexer switched on here is searched, and the results are merged. If one is
|
||||
unreachable the search still runs, narrower.
|
||||
</p>
|
||||
</div>
|
||||
{#each indexers as service (service.code)}
|
||||
<AcquisitionServiceRow {service} onChanged={load} />
|
||||
{:else}
|
||||
<p class="text-sm text-text-secondary">No indexer yet. Prowlarr is the usual choice.</p>
|
||||
{/each}
|
||||
{#if searchingExchanges.length > 0}
|
||||
<p class="text-xs text-text-secondary">
|
||||
Also searched: {searchingExchanges.map((s) => s.label).join(', ')}, set up under download
|
||||
clients below.
|
||||
</p>
|
||||
{/if}
|
||||
{@render addMenu('search', 'Add indexer')}
|
||||
</div>
|
||||
|
||||
<div class="space-y-3 border-t border-border pt-5" data-testid="download-clients">
|
||||
<div>
|
||||
<h4 class="text-sm font-medium text-text-primary">
|
||||
Download clients: what actually downloads
|
||||
</h4>
|
||||
<p class="text-xs text-text-secondary">
|
||||
What a grab is handed to. A FabledExchange here can do more than download, and its entry
|
||||
says which of its jobs are switched on.
|
||||
</p>
|
||||
</div>
|
||||
{#each clients as service (service.code)}
|
||||
<AcquisitionServiceRow {service} onChanged={load} />
|
||||
{:else}
|
||||
<p class="text-sm text-text-secondary">No download client yet.</p>
|
||||
{/each}
|
||||
{@render addMenu('download', 'Add download client')}
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
Reference in New Issue
Block a user