feat: scrape STRM libraries after refresh

This commit is contained in:
ShukeBta
2026-07-03 01:18:27 +08:00
parent a6f2d0208d
commit 9833c60e38
12 changed files with 257 additions and 35 deletions
+13 -7
View File
@@ -2,6 +2,7 @@ import { Loader2, RotateCcw, Wrench } from 'lucide-react'
import type { STRMOutputPreset } from '../api/strm'
import { currentOrigin } from './strmPageModel'
import { StrmRefreshStatus } from './StrmGenerateSectionParts'
import { StrmOutputDirPicker } from './StrmOutputDirPicker'
import type { useStrmRepairForm } from './useStrmRepairForm'
@@ -17,11 +18,13 @@ export function StrmRepairSection({
refreshLibrary,
result,
runningMode,
scrapeAfter,
onPreview,
onRepair,
setBaseURL,
setOutputDir,
setRefreshLibrary,
setScrapeAfter,
}: StrmRepairSectionProps) {
return (
<section className="glass-panel space-y-4">
@@ -55,6 +58,15 @@ export function StrmRepairSection({
<input type="checkbox" checked={refreshLibrary} onChange={(e) => setRefreshLibrary(e.target.checked)} />
修复后刷新媒体库
</label>
<label className={`flex min-h-10 items-center gap-2 rounded-2xl border border-gray-200 bg-white/70 px-3 py-2 text-sm text-ink-50 md:col-span-4 ${!refreshLibrary ? 'cursor-not-allowed opacity-50' : ''}`}>
<input
type="checkbox"
checked={refreshLibrary && scrapeAfter}
disabled={!refreshLibrary}
onChange={(e) => setScrapeAfter(e.target.checked)}
/>
刷新后自动刮削
</label>
<button
type="button"
disabled={repairing || !outputDir.trim()}
@@ -76,13 +88,7 @@ export function StrmRepairSection({
{result.previewed ? `预检 ${result.previewed} · ` : ''}
修复 {result.repaired} · 跳过 {result.skipped}
</div>
{result.refresh && (
<div className={result.refresh.queued ? 'mt-1 text-emerald-600' : 'mt-1 text-amber-600'}>
{result.refresh.queued
? `媒体库刷新已排队:${result.refresh.targets?.map((target) => target.name).join('、') || '已匹配媒体库'}`
: `媒体库未刷新:${result.refresh.reason || '未匹配到可扫描媒体库'}`}
</div>
)}
<StrmRefreshStatus refresh={result.refresh} />
{result.errors && result.errors.length > 0 && (
<div className="mt-2 text-red-500">
失败 {result.errors.length} 条:{result.errors.slice(0, 3).join(';')}