mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-07 05:46:38 +08:00
feat(organize/scan): transfer modes, seeding-safe relocation, inode dedup, incremental scanning
- Organizer: add move/copy/hardlink/symlink transfer modes (default move), per-request target_path/transfer_mode overrides, and honor organize.target_dir / organize.transfer_mode settings. - keep_seeding (default on): escalate move->hardlink (cross-device->copy) so the qBittorrent source stays in place and continues seeding after organize. - qBittorrent SetLocation + POST /downloads/relocate to migrate whole torrents while keeping them seeding. - Scanner: FileID (device:inode) hardlink dedup to avoid duplicate recognition and double-counted storage; extract single-file ingest. - Watcher: recursive watch + incremental per-file ingest/remove instead of full re-scan; periodic full library scan now gated behind scan.periodic_enabled (default off) to reduce disk wear. - Telegram bot: handle callback_query in polling, declare allowed_updates in webhook, answer callbacks. - Frontend: settings for transfer mode / keep_seeding / periodic scan; organize panel target dir + transfer mode overrides. - Tests for transfer modes, organizer resolution, SetLocation, inode dedup, incremental ingest/remove. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
@@ -61,6 +61,17 @@ function OrganizePanel() {
|
||||
const [smartClassify, setSmartClassify] = useState(false)
|
||||
const [loadingSettings, setLoadingSettings] = useState(true)
|
||||
|
||||
// 单次整理覆盖项:留空则沿用设置页的默认整理目录与转移方式。
|
||||
const [targetPath, setTargetPath] = useState('')
|
||||
const [transferMode, setTransferMode] = useState('')
|
||||
|
||||
const overrides = () => {
|
||||
const o: { target_path?: string; transfer_mode?: string } = {}
|
||||
if (targetPath.trim()) o.target_path = targetPath.trim()
|
||||
if (transferMode) o.transfer_mode = transferMode
|
||||
return o
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
libraryAPI.list().then(setLibraries).catch(() => undefined)
|
||||
}, [])
|
||||
@@ -87,7 +98,7 @@ function OrganizePanel() {
|
||||
if (!libraryID) return
|
||||
setRunning(true)
|
||||
try {
|
||||
await toolsAPI.organizeLibrary(libraryID)
|
||||
await toolsAPI.organizeLibrary(libraryID, overrides())
|
||||
toast.success('已触发媒体库整理')
|
||||
} catch (err: unknown) {
|
||||
const msg =
|
||||
@@ -116,8 +127,8 @@ function OrganizePanel() {
|
||||
const onOrganizeOne = async (m: Media) => {
|
||||
setBusyID(m.id)
|
||||
try {
|
||||
const r = await toolsAPI.organizeMedia(m.id)
|
||||
toast.success(`已移动到 ${r.path}`)
|
||||
const r = await toolsAPI.organizeMedia(m.id, overrides())
|
||||
toast.success(`已整理到 ${r.path}`)
|
||||
} catch (err: unknown) {
|
||||
const msg =
|
||||
(err as { response?: { data?: { error?: string } } })?.response?.data?.error ??
|
||||
@@ -151,6 +162,32 @@ function OrganizePanel() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="grid gap-3 rounded-xl border border-gray-200 bg-gray-50 p-3 sm:grid-cols-2">
|
||||
<label className="space-y-1">
|
||||
<span className="text-xs text-ink-50">整理目标目录(可选,覆盖默认设置)</span>
|
||||
<input
|
||||
className="input-base w-full"
|
||||
placeholder="留空则使用「整理目标目录」设置或媒体库路径"
|
||||
value={targetPath}
|
||||
onChange={(e) => setTargetPath(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="space-y-1">
|
||||
<span className="text-xs text-ink-50">转移方式(可选,覆盖默认设置)</span>
|
||||
<select
|
||||
className="input-base w-full"
|
||||
value={transferMode}
|
||||
onChange={(e) => setTransferMode(e.target.value)}
|
||||
>
|
||||
<option value="">使用默认设置</option>
|
||||
<option value="move">移动(删除源文件)</option>
|
||||
<option value="copy">复制(保留源文件)</option>
|
||||
<option value="hardlink">硬链接(保留源,做种不中断)</option>
|
||||
<option value="symlink">软链接(符号链接,保留源)</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<form onSubmit={onOrganizeLibrary} className="flex flex-wrap gap-2">
|
||||
<select
|
||||
required
|
||||
|
||||
Reference in New Issue
Block a user