跳到主要内容

影视 API

本文介绍 AMMDS 影视相关 API 接口,包括影视导入、详情查询、检索匹配等操作。

影视导入

导入影视元数据,支持文件上传(海报、背景图等)。

项目说明
接口路径/api/v1/movie/import
请求方式POST
鉴权是(x-api-key
Content-Typemultipart/form-data

请求参数

字段类型必填说明
uniqueidString番号/唯一标识
originalTitleString原始标题
titleCnString中文标题
plotString剧情简介
plotCnString中文剧情简介
ratingDouble评分
premieredString发行日期
runtimeInteger时长(分钟)
languageString语言
countryString国家/地区
mosaicString马赛克类型
numbersString番号列表(JSON 数组字符串)
genresString类型标签(JSON 数组字符串)
tagsString标签(JSON 数组字符串)
studioString制作公司(JSON 数组字符串)
issueStudioString发行公司(JSON 数组字符串)
directorString导演(JSON 数组字符串)
actorsString演员列表(JSON 数组字符串)
subscribeBoolean是否订阅(默认 false
favoriteBoolean是否收藏(默认 false
posterFile[]海报图片文件
posterUrlString海报 URL(JSON 数组字符串)
fanartFile[]背景图文件
fanartUrlString背景图 URL(JSON 数组字符串)
thumbFile[]缩略图文件
thumbUrlString缩略图 URL(JSON 数组字符串)
extrafanartFile[]额外背景图文件
extrafanartUrlString额外背景图 URL(JSON 数组字符串)

请求示例

curl -X POST "http://localhost:8080/api/v1/movie/import" \
-H "x-api-key: your-api-key-here" \
-F "uniqueid=ABC-123" \
-F "originalTitle=Sample Movie" \
-F "titleCn=示例影片" \
-F "plot=This is a sample movie." \
-F "rating=8.5" \
-F "premiered=2024-01-15" \
-F "runtime=120" \
-F "language=ja" \
-F "mosaic=有码" \
-F 'genres=["动作","剧情"]' \
-F 'tags=["热门","推荐"]' \
-F "subscribe=true" \
-F "poster=@/path/to/poster.jpg"

响应参数

字段类型说明
dataBooleantrue 表示导入成功

成功响应示例

{
"code": 200,
"message": "成功",
"data": true,
"timestamp": 1753958400000
}

失败响应示例

{
"code": 500,
"message": "导入失败",
"data": false,
"timestamp": 1753958400000
}

快捷导入

简化版影视导入,使用 JSON 请求体,无需文件上传,适合开发者快速导入元数据。

项目说明
接口路径/api/v1/movie/import/quick
请求方式POST
鉴权是(x-api-key
Content-Typeapplication/json

请求参数

字段类型必填说明
uniqueidString番号/唯一标识
originalTitleString原始标题
titleCnString中文标题
plotString剧情简介
plotCnString中文剧情简介
ratingDouble评分
premieredString发行日期
runtimeInteger时长(分钟)
languageString语言
countryString国家/地区
mosaicString马赛克类型
numbersString[]番号列表
genresString[]类型标签
tagsString[]标签
studioString[]制作公司
issueStudioString[]发行公司
directorString[]导演列表
posterUrlString[]海报图片 URL 列表
fanartUrlString[]背景图 URL 列表
thumbUrlString[]缩略图 URL 列表
extrafanartUrlString[]额外背景图 URL 列表
subscribeBoolean是否订阅(默认 false
favoriteBoolean是否收藏(默认 false

请求示例

curl -X POST "http://localhost:8080/api/v1/movie/import/quick" \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-d '{
"uniqueid": "ABC-123",
"originalTitle": "Sample Movie",
"titleCn": "示例影片",
"plot": "这是一部示例影片。",
"rating": 8.5,
"premiered": "2024-01-15",
"runtime": 120,
"language": "ja",
"mosaic": "有码",
"genres": ["动作", "剧情"],
"tags": ["热门", "推荐"],
"posterUrl": ["https://example.com/poster.jpg"],
"subscribe": true
}'

响应参数

字段类型说明
dataBooleantrue 表示导入成功

成功响应示例

{
"code": 200,
"message": "成功",
"data": true,
"timestamp": 1753958400000
}

失败响应示例

{
"code": 500,
"message": "导入失败",
"data": false,
"timestamp": 1753958400000
}

从数据源导入

通过指定数据源和影视 ID,直接从第三方数据源获取完整元数据并导入到本地库。

项目说明
接口路径/api/v1/movie/import/from-source
请求方式POST
鉴权是(x-api-key
Content-Typeapplication/json

请求参数

字段类型必填说明
sourceString数据源标识,可选值见附录 B
idString目标影视在数据源中的 ID
providerString数据源子类型(按数据源区分)

请求示例

curl -X POST "http://localhost:8080/api/v1/movie/import/from-source" \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-d '{
"source": "metatube",
"id": "12345"
}'

响应参数

字段类型说明
dataString导入成功后返回新创建的影片 ID;失败时为 null

成功响应示例

{
"code": 200,
"message": "成功",
"data": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"timestamp": 1753958400000
}

失败响应示例

{
"code": 500,
"message": "导入失败,请检查数据源和参数",
"data": null,
"timestamp": 1753958400000
}

影片详情

根据影片 ID 获取完整的影片元数据。

项目说明
接口路径/api/v1/movie/{id}
请求方式GET
鉴权是(x-api-key
Content-Type

路径参数

字段类型必填说明
idString影片 ID(UUID 格式)

请求示例

curl -X GET "http://localhost:8080/api/v1/movie/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "x-api-key: your-api-key-here"

响应参数

字段类型说明
idString影片 ID
uniqueidString番号/唯一标识
originalTitleString原始标题
titleCnString中文标题
plotString剧情简介
plotCnString中文剧情简介
taglineString标语
outlineString概要
ratingDouble评分
premieredString发行日期
posterString海报 URL
fanartString背景图 URL
thumbString缩略图 URL
extrafanartString额外背景图 URL
genreString[]类型标签列表
tagString[]标签列表
studioString[]制作公司列表
issueStudioString[]发行公司列表
runtimeInteger时长(分钟)
mpaaString分级
languageString语言
countryString国家/地区
setsMap系列信息
directorString[]导演列表
actorsMap演员信息
extendMap扩展信息
sourceLinksMap来源链接
filesObject[]关联文件列表
sharedBoolean是否共享
finishedBoolean是否完结
subscribeBoolean是否订阅

成功响应示例

{
"code": 200,
"message": "成功",
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"uniqueid": "ABC-123",
"originalTitle": "Sample Movie",
"titleCn": "示例影片",
"plot": "这是一部示例影片的剧情简介。",
"plotCn": "这是一部示例影片的剧情简介(中文)。",
"tagline": "精彩不容错过",
"outline": "影片概要",
"rating": 8.5,
"premiered": "2024-01-15",
"poster": "https://example.com/poster.jpg",
"fanart": "https://example.com/fanart.jpg",
"thumb": "https://example.com/thumb.jpg",
"extrafanart": "https://example.com/extrafanart.jpg",
"genre": ["动作", "剧情"],
"tag": ["热门", "推荐"],
"studio": ["Sample Studio"],
"issueStudio": ["Sample Publisher"],
"runtime": 120,
"mpaa": "R18",
"language": "ja",
"country": "日本",
"sets": {},
"director": ["导演A"],
"actors": {"主演A": "角色A"},
"extend": {},
"sourceLinks": {},
"files": [],
"shared": false,
"finished": false,
"subscribe": true
},
"timestamp": 1753958400000
}

失败响应示例

{
"code": 404,
"message": "影片不存在",
"data": null,
"timestamp": 1753958400000
}

影片总数

获取当前系统中已入库的影片总数。

项目说明
接口路径/api/v1/movie/count
请求方式GET
鉴权是(x-api-key
Content-Type

请求参数

无。

请求示例

curl -X GET "http://localhost:8080/api/v1/movie/count" \
-H "x-api-key: your-api-key-here"

响应参数

字段类型说明
dataInteger影片总数

成功响应示例

{
"code": 200,
"message": "成功",
"data": 1024,
"timestamp": 1753958400000
}

影片匹配

通过番号或文件哈希(pHash / osHash)查找本地已入库的影片 ID,可用于本地文件与媒体库的自动匹配。

项目说明
接口路径/api/v1/movie/lookup
请求方式POST
鉴权是(x-api-key
Content-Typeapplication/json

请求参数

字段类型必填说明
numberString番号
pHashString感知哈希(Perceptual Hash)
osHashString文件系统哈希

注意numberpHashosHash 至少提供一个,否则返回参数错误。

请求示例

curl -X POST "http://localhost:8080/api/v1/movie/lookup" \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-d '{
"number": "ABC-123"
}'

响应参数

字段类型说明
dataString匹配到的影片 ID;未匹配到时为 null

成功响应示例

{
"code": 200,
"message": "成功",
"data": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"timestamp": 1753958400000
}

未匹配响应示例

{
"code": 200,
"message": "成功",
"data": null,
"timestamp": 1753958400000
}

错误码

状态码说明
400numberpHashosHash 三个参数均为空

影片检索

调用所有已开启的数据源进行在线影片检索,返回统一结构的检索结果。

项目说明
接口路径/api/v1/movie/search
请求方式POST
鉴权是(x-api-key
Content-Typeapplication/json

请求参数

字段类型必填说明
keywordString检索关键词(番号或影片名)
waitTimeInteger超时时间(秒),默认 60

请求示例

curl -X POST "http://localhost:8080/api/v1/movie/search" \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key-here" \
-d '{
"keyword": "ABC-123",
"waitTime": 30
}'

响应参数(data[] 中每项字段)

字段类型说明
idString检索结果 ID
providerString数据源标识
sourceString数据源名称
numberString番号
titleString标题
summaryString简介
urlString详情页 URL
coverString封面图 URL
thumbString缩略图 URL
previewImagesString[]预览图/剧照 URL 列表
trailerUrlString预告片 URL
actorsString[]演员列表
directorString导演
genresString[]类型标签列表
tagsString[]标签列表
studioString制作公司
labelString厂商标识
seriesString系列名称
scoreDouble评分
runtimeInteger时长(分钟)
releaseString发行日期
mosaicString马赛克信息
extrasMap<String, Object>扩展字段,承载数据源特有数据

注意:各数据源按自身能力填充字段,不支持的字段返回 null

成功响应示例

{
"code": 200,
"message": "成功",
"data": [
{
"id": "12345",
"provider": "metatube",
"source": "MetaTube",
"number": "ABC-123",
"title": "Sample Movie Title",
"summary": "This is a sample movie summary.",
"url": "https://example.com/movie/12345",
"cover": "https://example.com/cover.jpg",
"thumb": "https://example.com/thumb.jpg",
"previewImages": ["https://example.com/preview1.jpg"],
"trailerUrl": null,
"actors": ["Actor A", "Actor B"],
"director": "Director X",
"genres": ["动作", "剧情"],
"tags": ["热门"],
"studio": "Sample Studio",
"label": null,
"series": null,
"score": 8.5,
"runtime": 120,
"release": "2024-01-15",
"mosaic": null,
"extras": {}
}
],
"timestamp": 1753958400000
}