mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-30 03:36:37 +08:00
fix: improve media file organization workflow
This commit is contained in:
+21
-2
@@ -6,6 +6,7 @@ export interface FileEntry {
|
||||
is_dir: boolean
|
||||
size: number
|
||||
modified: number
|
||||
ext?: string
|
||||
}
|
||||
|
||||
export interface FileListing {
|
||||
@@ -16,8 +17,26 @@ export interface FileListing {
|
||||
}
|
||||
|
||||
export const filesAPI = {
|
||||
list: (path = '', max = 1000) =>
|
||||
list: (path = '', max = 1000, recursive = false) =>
|
||||
api
|
||||
.get<FileListing>('/files', { params: { path, max } })
|
||||
.get<FileListing>('/files', { params: { path, max, recursive } })
|
||||
.then((r) => r.data),
|
||||
|
||||
createFolder: (path: string, name: string) =>
|
||||
api.post<{ path: string }>('/files/folders', { path, name }).then((r) => r.data),
|
||||
|
||||
rename: (path: string, name: string) =>
|
||||
api.put<{ path: string }>('/files/rename', { path, name }).then((r) => r.data),
|
||||
|
||||
remove: (path: string) =>
|
||||
api.delete<{ removed: boolean }>('/files', { params: { path } }).then((r) => r.data),
|
||||
|
||||
transfer: (sourcePath: string, destPath: string, transferMode = 'copy') =>
|
||||
api
|
||||
.post<{ path: string }>('/files/transfer', {
|
||||
source_path: sourcePath,
|
||||
dest_path: destPath,
|
||||
transfer_mode: transferMode,
|
||||
})
|
||||
.then((r) => r.data),
|
||||
}
|
||||
|
||||
+32
-1
@@ -10,6 +10,10 @@ export interface OrganizeOverrides {
|
||||
source_path?: string
|
||||
dest_path?: string
|
||||
transfer_mode?: string
|
||||
media_type?: string
|
||||
scan_after?: boolean
|
||||
library_id?: string
|
||||
dry_run?: boolean
|
||||
}
|
||||
|
||||
// OrganizeSource is a selectable organize source directory (e.g. the download
|
||||
@@ -45,7 +49,34 @@ export const toolsAPI = {
|
||||
// into the destination with dedup + 洗版 (resolution replacement).
|
||||
organizeDirectory: (opts: OrganizeOverrides) =>
|
||||
api
|
||||
.post<{ organized: number; skipped: number; replaced?: number; errors?: string[] }>(
|
||||
.post<{
|
||||
organized: number
|
||||
skipped: number
|
||||
replaced?: number
|
||||
source_path?: string
|
||||
dest_path?: string
|
||||
errors?: string[]
|
||||
dry_run?: boolean
|
||||
items?: Array<{
|
||||
source: string
|
||||
target?: string
|
||||
action: string
|
||||
reason?: string
|
||||
media_type?: string
|
||||
category?: string
|
||||
title?: string
|
||||
}>
|
||||
scans?: Array<{
|
||||
library_id: string
|
||||
name: string
|
||||
path: string
|
||||
visited: number
|
||||
added: number
|
||||
updated: number
|
||||
removed: number
|
||||
error?: string
|
||||
}>
|
||||
}>(
|
||||
'/admin/organize/source',
|
||||
opts,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user