进阶 docs.stashapp.cc 2026-10-20 02:59:21 · 12 阅读
第19章 Stash 的 JSON 导入/导出规范
JSON 导入/导出规范¶
Stash 中的元数据可以导出为 JSON 格式。该结构可被修改,或通过其他方式复制。导出数据随后可以再次导入,从而实现各种场景下的自动化抓取。此元数据集合的格式是一个文件夹结构,包含以下子目录:
files
galleries
images
performers
scenes
studios
groups
文件命名¶
导出时,文件名根据对象类型采用不同的格式:
类型
格式
文件/文件夹
<路径深度(十六进制,两位字符宽度)>.<基础名称>.<哈希值>.json
图集
<首个 zip 文件名>.<路径哈希值>.json 或 <文件夹基础名称>.<路径哈希值>.json 或 <标题>.json
图片
<标题或首个文件基础名称>.<哈希值>.json
演员
<姓名>.json
场景
<标题或首个文件基础名称>.<哈希值>.json
工作室
<姓名>.json
分组
<姓名>.json
⚠️ 注意:导入时文件名不重要。所有 JSON 文件都将从子目录中读取。
JSON 文件内容¶
以下将展示对应 JSON 文件的值。如果某个值本应是数字(如 29.98 或 50.0),它仍以字符串形式书写,逗号后带小数。大部分值的含义根据前文的解释或 Stash 编辑时可用的选项值即可推断;若不明显,则会补充简短注释。
除非另有说明,JSON 值均以字符串形式提供。每个新行代表 JSON 中的一个新值。如果值是对象列表,该对象的值将以缩进方式展示。
如果某个文件中的值为空,可完全省略该值。
许多文件包含 created_at 和 updated_at,二者均采用以下格式:
YYYY-MM-DDThh:mm:ssTZD
示例:
"created_at": "2019-05-03T21:36:58+01:00" 演员 name url twitter instagram birthdate death_date ethnicity country hair_color eye_color height weight measurements fake_tits career_length tattoos piercings image (图像文件的 base64 编码) created_at updated_at rating (整数) details 制片厂 name url image (图像文件的 base64 编码) created_at updated_at rating (整数) details 场景 title studio url date rating (整数) details performers (字符串列表,演员姓名) tags (字符串列表) markers title seconds primary_tag tags (字符串列表) created_at updated_at file (非列表,而是单个对象) size (以字节为单位,小数点后无值) duration (以秒为单位) video_codec (示例值:h264) audio_codec (示例值:aac) width (整数,单位像素) height (整数,单位像素) framerate bitrate (整数,单位位) created_at updated_at 图片 title studio rating (整数) performers (字符串列表,演员姓名) tags (字符串列表) files (路径字符串列表) galleries zip_files (路径字符串列表) folder_path title (用户创建相册的标题) created_at updated_at 相册 title studio url date rating (整数) details performers (字符串列表,演员姓名) tags (字符串列表) zip_files (路径字符串列表) folder_path created_at updated_at 文件 文件夹 zip_file (包含该 zip 文件的路径) mod_time type (= folder) path created_at updated_at 视频文件 zip_file (包含该 zip 文件的路径) mod_time type (= video) path fingerprints type fingerprint size format width height duration video_codec audio_codec frame bitrate interactive (布尔值) interactive_speed (整数) created_at updated_at 图片文件 zip_file (包含该 zip 文件的路径) mod_time type (= image) path fingerprints type fingerprint size format width height created_at updated_at 其他文件 zip_file (包含该 zip 文件的路径) mod_time type (= file) path fingerprints type fingerprint size created_at updated_at JSON 格式 对于那些更喜欢 JSON 格式的人,这里定义了一种可能更有趣的格式: performer.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#performerjson", "title": "performer", "description": "一个代表演员的 json 文件。文件名由 MD5 代码指定。", "type": "object", "properties": { "name": { "description": "演员姓名", "type": "string" }, "url": { "description": "演员个人网站的 URL", "type": "string" }, "twitter": { "description": "演员的 Twitter 用户名", "type": "string" }, "instagram": { "description": "演员的 Instagram 用户名", "type": "string" }, "birthdate": { "description": "演员出生日期。格式为 YYYY-MM-DD", "type": "string" }, "death_date": { "description": "演员逝世日期。格式为 YYYY-MM-DD", "type": "string" }, "ethnicity": { "description": "演员的族裔。可能值为 black, white, asian 或 hispanic", "type": "string" }, "country": { "description": "演员所在国家", "type": "string" }, "hair_color": { "description": "演员发色", "type": "string" }, "eye_color": { "description": "演员瞳色", "type": "string" }, "height": { "description": "演员身高(厘米)", "type": "string" }, "weight": { "description": "演员体重(千克)", "type": "string" }, "measurements": { "description": "演员三围尺寸", "type": "string" }, "fake_tits": { "description": "演员是否拥有植入物。可能值为 Yes 或 No", "type": "string" }, "career_length": { "description": "演员从业时长。格式为 YYYY-YYYY", "type": "string" }, "tattoos": { "description": "演员纹身的描述(如有)", "type": "string" }, "piercings": { "description": "演员穿孔饰物的描述(如有)", "type": "string" }, "image": { "description": "演员图像,解析为 base64", "type": "string" }, "created_at": { "description": "该演员数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该演员数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "details": { "description": "演员的描述", "type": "string" } }, "required": ["name", "ethnicity", "image", "created_at", "updated_at"] } studio.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#studiojson", "title": "studio", "description": "一个代表制片厂的 json 文件。文件名由 MD5 代码指定。", "type": "object", "properties": { "name": { "description": "制片厂名称", "type": "string" }, "url": { "description": "制片厂网站 URL", "type": "string" }, "image": { "description": "制片厂标志,解析为 base64", "type": "string" }, "created_at": { "description": "该制片厂数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该制片厂数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "details": { "description": "制片厂的描述", "type": "string" } }, "required": ["name", "image", "created_at", "updated_at"] } scene.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#scenejson", "title": "scene", "description": "一个代表场景的 json 文件。文件名由其所引用文件的 MD5 代码指定。", "type": "object", "properties": { "title": { "description": "场景标题", "type": "string" }, "studio": { "description": "制作该场景的制片厂名称", "type": "string" }, "url": { "description": "场景原始来源的 URL", "type": "string" }, "date": { "description": "场景发布日期。格式为 YYYY-MM-DD", "type": "string" }, "rating": { "description": "场景评分。以星级表示,范围从 1 到 5", "type": "integer" }, "details": { "description": "场景描述,包含情节脉络等内容", "type": "string" }, "performers": { "description": "该场景演员姓名的列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "tags": { "description": "与该场景关联的标签列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "markers": { "description": "标记用于标识场景中的特定事件,最常见的是体位变化。它们带有自身的标签。", "type": "array", "items": { "type": "object", "properties": { "title": { "description": "标记的可搜索名称", "type": "string" }, "seconds": { "description": "标记设定的秒数。包含小数部分,例如 10.0 或 17.5", "type": "string" }, "primary_tag": { "description": "标识该标记的标签。同一场景中主标签相同的多个标记会被拼接显示,表明它们性质相似", "type": "string" }, "tags": { "description": "与该标记关联的标签列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "created_at": { "description": "该标记添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该标记最后一次更新的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" } }, "required": ["seconds", "primary_tag", "created_at", "updated_at"] }, "minItems": 1, "uniqueItems": true }, "files": { "description": "该场景文件的路径列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "created_at": { "description": "该场景数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该场景数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" } }, "required": ["files", "created_at", "updated_at"] }
"created_at": "2019-05-03T21:36:58+01:00" 演员 name url twitter instagram birthdate death_date ethnicity country hair_color eye_color height weight measurements fake_tits career_length tattoos piercings image (图像文件的 base64 编码) created_at updated_at rating (整数) details 制片厂 name url image (图像文件的 base64 编码) created_at updated_at rating (整数) details 场景 title studio url date rating (整数) details performers (字符串列表,演员姓名) tags (字符串列表) markers title seconds primary_tag tags (字符串列表) created_at updated_at file (非列表,而是单个对象) size (以字节为单位,小数点后无值) duration (以秒为单位) video_codec (示例值:h264) audio_codec (示例值:aac) width (整数,单位像素) height (整数,单位像素) framerate bitrate (整数,单位位) created_at updated_at 图片 title studio rating (整数) performers (字符串列表,演员姓名) tags (字符串列表) files (路径字符串列表) galleries zip_files (路径字符串列表) folder_path title (用户创建相册的标题) created_at updated_at 相册 title studio url date rating (整数) details performers (字符串列表,演员姓名) tags (字符串列表) zip_files (路径字符串列表) folder_path created_at updated_at 文件 文件夹 zip_file (包含该 zip 文件的路径) mod_time type (= folder) path created_at updated_at 视频文件 zip_file (包含该 zip 文件的路径) mod_time type (= video) path fingerprints type fingerprint size format width height duration video_codec audio_codec frame bitrate interactive (布尔值) interactive_speed (整数) created_at updated_at 图片文件 zip_file (包含该 zip 文件的路径) mod_time type (= image) path fingerprints type fingerprint size format width height created_at updated_at 其他文件 zip_file (包含该 zip 文件的路径) mod_time type (= file) path fingerprints type fingerprint size created_at updated_at JSON 格式 对于那些更喜欢 JSON 格式的人,这里定义了一种可能更有趣的格式: performer.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#performerjson", "title": "performer", "description": "一个代表演员的 json 文件。文件名由 MD5 代码指定。", "type": "object", "properties": { "name": { "description": "演员姓名", "type": "string" }, "url": { "description": "演员个人网站的 URL", "type": "string" }, "twitter": { "description": "演员的 Twitter 用户名", "type": "string" }, "instagram": { "description": "演员的 Instagram 用户名", "type": "string" }, "birthdate": { "description": "演员出生日期。格式为 YYYY-MM-DD", "type": "string" }, "death_date": { "description": "演员逝世日期。格式为 YYYY-MM-DD", "type": "string" }, "ethnicity": { "description": "演员的族裔。可能值为 black, white, asian 或 hispanic", "type": "string" }, "country": { "description": "演员所在国家", "type": "string" }, "hair_color": { "description": "演员发色", "type": "string" }, "eye_color": { "description": "演员瞳色", "type": "string" }, "height": { "description": "演员身高(厘米)", "type": "string" }, "weight": { "description": "演员体重(千克)", "type": "string" }, "measurements": { "description": "演员三围尺寸", "type": "string" }, "fake_tits": { "description": "演员是否拥有植入物。可能值为 Yes 或 No", "type": "string" }, "career_length": { "description": "演员从业时长。格式为 YYYY-YYYY", "type": "string" }, "tattoos": { "description": "演员纹身的描述(如有)", "type": "string" }, "piercings": { "description": "演员穿孔饰物的描述(如有)", "type": "string" }, "image": { "description": "演员图像,解析为 base64", "type": "string" }, "created_at": { "description": "该演员数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该演员数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "details": { "description": "演员的描述", "type": "string" } }, "required": ["name", "ethnicity", "image", "created_at", "updated_at"] } studio.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#studiojson", "title": "studio", "description": "一个代表制片厂的 json 文件。文件名由 MD5 代码指定。", "type": "object", "properties": { "name": { "description": "制片厂名称", "type": "string" }, "url": { "description": "制片厂网站 URL", "type": "string" }, "image": { "description": "制片厂标志,解析为 base64", "type": "string" }, "created_at": { "description": "该制片厂数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该制片厂数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "details": { "description": "制片厂的描述", "type": "string" } }, "required": ["name", "image", "created_at", "updated_at"] } scene.json { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.stashapp.cc/in-app-manual/tasks/jsonspec#scenejson", "title": "scene", "description": "一个代表场景的 json 文件。文件名由其所引用文件的 MD5 代码指定。", "type": "object", "properties": { "title": { "description": "场景标题", "type": "string" }, "studio": { "description": "制作该场景的制片厂名称", "type": "string" }, "url": { "description": "场景原始来源的 URL", "type": "string" }, "date": { "description": "场景发布日期。格式为 YYYY-MM-DD", "type": "string" }, "rating": { "description": "场景评分。以星级表示,范围从 1 到 5", "type": "integer" }, "details": { "description": "场景描述,包含情节脉络等内容", "type": "string" }, "performers": { "description": "该场景演员姓名的列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "tags": { "description": "与该场景关联的标签列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "markers": { "description": "标记用于标识场景中的特定事件,最常见的是体位变化。它们带有自身的标签。", "type": "array", "items": { "type": "object", "properties": { "title": { "description": "标记的可搜索名称", "type": "string" }, "seconds": { "description": "标记设定的秒数。包含小数部分,例如 10.0 或 17.5", "type": "string" }, "primary_tag": { "description": "标识该标记的标签。同一场景中主标签相同的多个标记会被拼接显示,表明它们性质相似", "type": "string" }, "tags": { "description": "与该标记关联的标签列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "created_at": { "description": "该标记添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该标记最后一次更新的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" } }, "required": ["seconds", "primary_tag", "created_at", "updated_at"] }, "minItems": 1, "uniqueItems": true }, "files": { "description": "该场景文件的路径列表", "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true }, "created_at": { "description": "该场景数据添加至数据库的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" }, "updated_at": { "description": "该场景数据在数据库中最后修改的时间。格式为 YYYY-MM-DDThh:mm:ssTZD", "type": "string" } }, "required": ["files", "created_at", "updated_at"] }