136 lines
2.1 KiB
Markdown
136 lines
2.1 KiB
Markdown
# Domain Model
|
|
|
|
## Task
|
|
|
|
一个任务代表一条完整的视频处理链路。
|
|
|
|
```json
|
|
{
|
|
"id": "task_01",
|
|
"source_type": "local_file",
|
|
"source_path": "stage/example.mp4",
|
|
"title": "王海颖唱歌录播 03月29日 22时02分",
|
|
"status": "published",
|
|
"created_at": "2026-03-30T07:50:42+08:00",
|
|
"updated_at": "2026-03-30T07:56:13+08:00"
|
|
}
|
|
```
|
|
|
|
### Fields
|
|
|
|
- `id`: 内部唯一 ID
|
|
- `source_type`: 输入来源,例如 `local_file`
|
|
- `source_path`: 原始文件路径
|
|
- `title`: 任务显示名称
|
|
- `status`: 当前状态
|
|
- `created_at`
|
|
- `updated_at`
|
|
|
|
## TaskStep
|
|
|
|
一个任务中的单个处理步骤。
|
|
|
|
### Step Names
|
|
|
|
- `ingest`
|
|
- `transcribe`
|
|
- `song_detect`
|
|
- `split`
|
|
- `publish`
|
|
- `comment`
|
|
- `collection_a`
|
|
- `collection_b`
|
|
|
|
### Step Status
|
|
|
|
- `pending`
|
|
- `running`
|
|
- `succeeded`
|
|
- `failed_retryable`
|
|
- `failed_manual`
|
|
- `skipped`
|
|
|
|
## Artifact
|
|
|
|
任务产物。
|
|
|
|
### Artifact Types
|
|
|
|
- `source_video`
|
|
- `subtitle_srt`
|
|
- `songs_json`
|
|
- `songs_txt`
|
|
- `clip_video`
|
|
- `publish_bvid`
|
|
- `comment_record`
|
|
- `collection_record`
|
|
|
|
## PublishRecord
|
|
|
|
记录上传结果。
|
|
|
|
```json
|
|
{
|
|
"task_id": "task_01",
|
|
"platform": "bilibili",
|
|
"aid": 123456,
|
|
"bvid": "BV1xxxx",
|
|
"title": "【王海颖 (歌曲纯享版)】_03月29日 22时02分 共18首歌",
|
|
"published_at": "2026-03-30T07:56:13+08:00"
|
|
}
|
|
```
|
|
|
|
## CollectionBinding
|
|
|
|
记录视频与合集之间的绑定关系。
|
|
|
|
### Fields
|
|
|
|
- `task_id`
|
|
- `target`
|
|
- `season_id`
|
|
- `section_id`
|
|
- `bvid`
|
|
- `status`
|
|
- `last_error`
|
|
|
|
### Target Values
|
|
|
|
- `full_video_collection`
|
|
- `song_collection`
|
|
|
|
## Settings
|
|
|
|
统一配置项,按逻辑分组。
|
|
|
|
### Example Groups
|
|
|
|
- `runtime`
|
|
- `paths`
|
|
- `transcribe`
|
|
- `song_detect`
|
|
- `publish`
|
|
- `comment`
|
|
- `collection`
|
|
|
|
## Domain Events
|
|
|
|
### Core Events
|
|
|
|
- `TaskCreated`
|
|
- `TaskStepStarted`
|
|
- `TaskStepSucceeded`
|
|
- `TaskStepFailed`
|
|
- `ArtifactCreated`
|
|
- `PublishCompleted`
|
|
- `CommentCompleted`
|
|
- `CollectionSynced`
|
|
|
|
## State Machine Rules
|
|
|
|
- 同一时刻,一个步骤只能有一个 `running`
|
|
- 失败必须记录 `error_code` 和 `error_message`
|
|
- `published` 之前不能进入评论和合集步骤
|
|
- `songs_detected` 之前不能进入切歌步骤
|
|
- `transcribed` 之前不能进入识歌步骤
|