添加strm生成

添加strm
This commit is contained in:
truewhile
2026-08-24 14:36:17 +08:00
parent cd1297a30f
commit c55d29ae84
47 changed files with 11956 additions and 4 deletions
+148
View File
@@ -0,0 +1,148 @@
// STRM 管理相关类型定义(与后端 internal/model/strm.go 对应)。
export type StrmProvider = 'cloud115' | 'clouddrive2' | 'openlist' | 'local'
export const STRM_PROVIDER_LABELS: Record<StrmProvider, string> = {
cloud115: '115 网盘',
clouddrive2: 'CloudDrive2',
openlist: 'OpenList',
local: '本地目录',
}
export interface StrmAccount {
id: string
name: string
provider: StrmProvider
enabled: boolean
created_at: string
updated_at: string
last_test_at?: string | null
last_test_result: string
last_test_ok: boolean
has_credential: boolean
provider_label: string
}
export interface StrmAccountInput {
name?: string
provider: StrmProvider
config?: Record<string, string>
enabled?: boolean
}
export type StrmSyncStatus = 'idle' | 'running' | 'ok' | 'error' | 'canceled'
export interface StrmSyncPath {
id: string
name: string
account_id: string
provider: StrmProvider
remote_path: string
local_path: string
strm_base_url: string
video_ext: string
meta_ext: string
exclude_name: string
min_video_size_mb: number
add_path: number
download_meta: boolean
upload_meta: boolean
delete_dir: boolean
cron: string
enable_cron: boolean
enabled: boolean
created_at: string
last_sync_at?: string | null
last_sync_status: StrmSyncStatus
last_sync_message: string
account_name: string
account_enabled: boolean
}
export interface StrmSyncPathInput {
name?: string
account_id?: string
provider: StrmProvider
remote_path: string
local_path: string
strm_base_url?: string
video_ext?: string
meta_ext?: string
exclude_name?: string
min_video_size_mb?: number
add_path?: number
download_meta?: boolean
upload_meta?: boolean
delete_dir?: boolean
cron?: string
enable_cron?: boolean
enabled?: boolean
}
export interface StrmSyncRecord {
id: string
sync_path_id: string
status: 'pending' | 'running' | 'done' | 'failed' | 'canceled'
total: number
new_strm: number
new_meta: number
uploaded: number
pruned: number
skipped: number
message: string
started_at?: string | null
finished_at?: string | null
created_at: string
}
export type StrmTaskStatus = 'pending' | 'running' | 'done' | 'failed' | 'canceled'
export interface StrmTask {
id: string
kind: 'download' | 'upload'
sync_path_id: string
account_id: string
provider: StrmProvider
file_name: string
local_path: string
remote_path: string
size: number
status: StrmTaskStatus
error: string
retry_count: number
created_at: string
started_at?: string | null
finished_at?: string | null
}
export interface StrmQueueCounts {
pending: number
running: number
done: number
failed: number
canceled: number
}
export interface StrmQueueSnapshot {
counts: StrmQueueCounts
tasks: StrmTask[]
total: number // 当前过滤条件下任务总数
page: number // 当前页码(从 1 开始)
page_size: number // 单页大小
}
export interface StrmSettingsMap {
'strm.base_url': string
'strm.video_ext': string
'strm.meta_ext': string
'strm.exclude_name': string
'strm.min_video_size_mb': string
'strm.add_path': string
'strm.download_meta': string
'strm.upload_meta': string
'strm.delete_dir': string
'strm.download_threads': string
'strm.upload_threads': string
[key: string]: string
}
export type StrmTaskStatusFilter = 'all' | StrmTaskStatus