-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annim 元数据仓库 #77
Open
SeraphJACK
wants to merge
7
commits into
master
Choose a base branch
from
feat/annim
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+157
−30
Open
Annim 元数据仓库 #77
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
09edac8
annim
SeraphJACK 60edbe9
Update
SeraphJACK 822344c
Update
SeraphJACK c8f03f5
Requested changes
SeraphJACK da005e3
Requested changes
SeraphJACK ddd9276
Some requested changes
SeraphJACK ac00aac
Update src/06.anniv/03.playlist.md
SeraphJACK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Annim | ||
|
||
> ⚠️️ 目前的 `Annim` 仍处于 `Draft` 状态,尚未完全定稿。欢迎随时提出意见或建议。 | ||
|
||
> ⚠️️ 目前 `Annim` 协议的版本为 `1`。 | ||
|
||
`Annim` 是独立的元数据服务,每一个 `Annil` 都需要指定一个对应的 `Annim` 服务提供元数据。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Annim 元数据协议 | ||
|
||
Annim 元数据协议用于向客户端提供元数据服务。所有接口均使用 [Anni 信息导出格式](../06.anniv/07.export-format.md)。 | ||
SeraphJACK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## 元数据 | ||
|
||
### 专辑信息 | ||
|
||
通过 `album_id` 获得专辑元数据的接口。支持同时获取多张专辑的元数据信息。 | ||
|
||
#### Endpoint | ||
SeraphJACK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
`GET /album/:id` | ||
|
||
#### 请求参数 | ||
|
||
| 参数名 | 说明 | | ||
| ------ | ---------------------------- | | ||
| `id` | 待获取元数据的专辑 `ID` 列表 | | ||
|
||
#### 返回 | ||
|
||
返回以 `album_id` 为键,专辑元数据或空为值的 `Object`。 | ||
|
||
当查询成功时,值为专辑的 `AlbumDetail`,否则为 `null`。 | ||
|
||
### 获取 Tag 列表 | ||
|
||
`GET /tags` | ||
|
||
#### 返回 | ||
|
||
返回包含所有 `Tag` 的数组,类型为 `TagInfo[]` 。 | ||
|
||
### 按 Tag 检索专辑 | ||
SeraphJACK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
通过 Tag 检索归属于该 Tag 下的专辑列表。 | ||
|
||
该接口属于检索接口,标签使用「向上合并」的语义。即计算专辑标签时,需要取专辑内所有专辑标签、光盘标签和音轨标签的**并集**。具体定义见 [专辑信息 - 标签](../02.metadata-repository/02.album-information.md#标签)。 | ||
|
||
#### Endpoint | ||
|
||
`GET /tags/:tag/albums` | ||
|
||
#### 参数 | ||
|
||
| 参数名 | 类型 | 说明 | | ||
| ----------- | --------- | -------------------------------- | | ||
| `tag` | `string` | 路径中的 `tag` 参数,表示 Tag 名 | | ||
| `recursive` | `boolean` | 是否递归检索子 Tag 所包含专辑 | | ||
|
||
#### 返回 | ||
|
||
`AlbumDetail[]` | ||
|
||
#### 错误列表 | ||
|
||
| 错误代码 | 详情 | | ||
| -------- | ------------ | | ||
| `902000` | `Tag` 不存在 | | ||
|
||
### 获取 Tag 详细 | ||
|
||
#### Endpoint | ||
|
||
`GET /tags/:tag/detail` | ||
|
||
#### 参数 | ||
|
||
| 参数名 | 类型 | 说明 | | ||
| ------ | -------- | -------------------------------- | | ||
| `tag` | `string` | 路径中的 `tag` 参数,表示 Tag 名 | | ||
|
||
#### 返回 | ||
|
||
`TagDetail` | ||
|
||
### 获取 Tag 关系 | ||
|
||
#### Endpoint | ||
|
||
`GET /tag-graph` | ||
SeraphJACK marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#### 返回 | ||
|
||
返回 `tag` 依赖关系的邻接表,类型表示为 `Record<string, string[]>` 。 | ||
|
||
`Key-Value` 对应的是标签与其所包含的子标签。字符串格式为 `<EDITION>:<NAME>`,标签类型不可省略。 | ||
|
||
## 搜索 | ||
|
||
### Endpoint | ||
|
||
`GET /search` | ||
|
||
### 请求参数 | ||
|
||
| 参数名 | 类型 | 说明 | | ||
| --------- | -------- | ------------------------------------------- | | ||
| `type` | `string` | `album` 或 `track` ,分别代表搜索专辑或单曲 | | ||
| `keyword` | `string` | 搜索关键字 | | ||
| `limit` | `number` | 最多返回条目数 | | ||
| `offset` | `number` | 跳过多少条记录,缺省为 0 | | ||
|
||
### 返回 | ||
|
||
返回 `ScoredEntry<T>[]` ,结果按 `score` 降序排序,`T` 为 `AlbumDetail` 或 `TrackInfoWithAlbum` 。 | ||
|
||
#### 参数列表 | ||
|
||
```ts | ||
interface ScoredEntry<T> { | ||
content: T; | ||
// 归一化的 score ,必须为属于 [0, 100] 的浮点数 | ||
score: number; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Annim 元数据后端 | ||
|
||
Annim 不仅需要与客户端约定提供元数据的协议,也需要关于元数据来源的约定,这就是 Annim 元数据后端。 | ||
|
||
## Git repo 后端 | ||
|
||
使用 git 仓库作为元数据来源,仓库结构应符合[Anni 元数据仓库](../02.metadata-repository/00.readme.md)标准。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分可以参考一下另一个pr,我找一下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/ProjectAnni/book/blob/52985ca6eb7c3f5ecc371efd2d34563cfa5ce573/src/05.audio-library/01.protocol.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annim 应该是 required ,而 repo 和预构建 db 都应该用 annim 提供(?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No,
Annim
是 repo 的延伸,这样 repo 和 Annim 就是一对多的。Annim 和 db 一个是动态的数据源,一个是静态的数据源,也应该是平级的。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
annim 某种意义上来说是对 repo 的封装,为什么是平级的。而且要让客户端处理 git 也很麻烦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
哦,上面写错了, annim 和 db 是平级的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要解决的其实是:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那问题就是现在元数据的来源是抽象的,没有一个可用的 identifier 。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那我们给 repo 加一个 uuid?然后给版本加一个 hash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参考 nix flake 的 input?