mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-29 19:36:36 +08:00
refactor: split modules and harden scraping workflows
This commit is contained in:
@@ -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),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user