refactor: split modules and harden scraping workflows

This commit is contained in:
ShukeBta
2026-06-24 11:59:18 +08:00
parent efca3cbe69
commit 192f35d9fa
470 changed files with 47957 additions and 33839 deletions
+6 -4
View File
@@ -1,4 +1,5 @@
import { api } from './client'
import type { ScrapeOptions } from './library'
// toolsAPI groups admin-only endpoints that don't fit the other domain
// modules: organizing media files into the canonical naming layout, and
@@ -55,6 +56,7 @@ export const toolsAPI = {
organized: number
skipped: number
replaced?: number
reclassified?: number
source_path?: string
dest_path?: string
errors?: string[]
@@ -101,15 +103,15 @@ export const toolsAPI = {
// repairAndRescrapeAll 触发「全库修复+重刮」:先从媒体路径中的
// {tmdb-N}/{bangumi-N} 占位符回填缺失/错误的外部 ID,再批量重刮整库。
// 后端异步执行,立即返回;进度通过 WS "scrape" topic 推送。
repairAndRescrapeAll: () =>
repairAndRescrapeAll: (options?: ScrapeOptions) =>
api
.post<{ status: string }>('/admin/media/repair-rescrape', {})
.post<{ status: string }>('/admin/media/repair-rescrape', options ?? {})
.then((r) => r.data),
// repairAndRescrapeLibrary 触发「单库修复+重刮」:只对指定媒体库回填占位符
// 外部 ID 并重刮,不影响其它库。后端异步执行,进度通过 WS "scrape" topic 推送。
repairAndRescrapeLibrary: (libraryID: string) =>
repairAndRescrapeLibrary: (libraryID: string, options?: ScrapeOptions) =>
api
.post<{ status: string }>(`/admin/libraries/${libraryID}/repair-rescrape`, {})
.post<{ status: string }>(`/admin/libraries/${libraryID}/repair-rescrape`, options ?? {})
.then((r) => r.data),
}