跳转至

Project (项目)

Project 是 AIMage SDK 的核心模型,代表一个动画/影视制作项目。通过 Project 可以访问其下的所有资源。

获取项目

# 获取所有项目
for project in client.projects():
    print(f"{project.name} - {project.description}")

# 查找特定项目
projects = list(client.projects())
target = next(p for p in projects if p.name == "MyProject")

属性

属性 类型 说明
id str 项目唯一标识
name str 项目名称
description str 项目描述
created_at datetime 创建时间
updated_at datetime 更新时间
organization_id str 所属组织 ID
owner_id str 所有者 ID

方法

videos() -> Generator[Video, None, None]

获取项目下的所有视频,支持分页惰性加载。

for video in project.videos():
    print(f"S{video.season_number}E{video.episode_number}: {video.name}")
    print(f"  时长: {video.duration:.1f}s")
    print(f"  分辨率: {video.width}x{video.height}")

characters() -> Generator[Character, None, None]

获取项目下的所有角色。

for character in project.characters():
    print(f"{character.name} ({'主角' if character.is_protagonist else '配角'})")
    print(f"  特征: {', '.join(character.features)}")

reference_images() -> Generator[ReferenceImage, None, None]

获取项目下的所有参考图片(如背景美术、道具设计等)。

for ref_img in project.reference_images():
    print(f"{ref_img.file_name} - {ref_img.category}")

mangas() -> Generator[Manga, None, None]

获取项目下的所有漫画资源。

for manga in project.mangas():
    print(f"{manga.title} by {manga.author}")

novels() -> Generator[Novel, None, None]

获取项目下的所有小说资源。

for novel in project.novels():
    print(f"{novel.title} by {novel.author}")

metadata() -> Generator[Metadata, None, None]

获取项目的动态元数据信息。详细说明请参阅 Metadata 模型

for metadata in project.metadata():
    print(f"{metadata.category} - {metadata.name} ({metadata.category_type})")
    for option in metadata.options:
        print(f"  {option.key}: {option.value}")

search(...) -> Generator[Clip, None, None]

搜索项目中的片段。详细参数说明请参阅 搜索 章节。

for clip in project.search(query="桜"):
    print(clip.subtitle)

数据模型关系

Project
├── Video[]              # 视频列表
│   ├── Clip[]           # 片段列表
│   ├── VideoResource[]  # 视频附属资源(剧本、香盘表等)
│   ├── PredictCreator[] # 预测创作者
│   └── PredictCharacter[]  # 预测角色
├── Character[]          # 角色列表
├── ReferenceImage[]     # 参考图片列表
├── Manga[]              # 漫画列表
├── Novel[]              # 小说列表
└── Metadata[]           # 动态元数据列表