Repository navigation
feat(providers): use Bangumi structured staffs for authors and name_cn mapping - #25
Merged
Merged
Conversation
…n mapping
Fetch /p1/subjects/{id}/staffs/persons and map each person+position to
the archive-shaped PersonInfo, bringing the offline archive's person
enhancement to the online path: structured author/artist/translator
entities (no more infobox key enumeration for them) and nameCN display
names under the staffChineseNames switch.
Publisher classification is unchanged: Original/Localized still comes
from the infobox 出版社/其他出版社 key semantics — position 2004 entries
are flat and unordered in the API, so structured data is only used for
name_cn display mapping (same boundary as the archive path).
Books without their own staff relations fall back to the series staffs,
mirroring the archive fallback. Staffs fetch failures never block
metadata (empty persons degrade to the existing infobox parsing).
Next API person nameCN often carries disambiguation annotations (e.g. 星野真(动画人), verified live). publisher_display_name matches persons by exact name/name_cn against infobox publisher strings, so an annotated nameCN never matches. Run the shared clean_author_names chain (cleaned_person_name) on name/name_cn at ingest; display-side cleaning in person_display_name remains and is idempotent.
Staffs can carry dirty records with two people crammed into one name
("A・B"). cleaned_person_name kept only the first segment, silently
dropping the collaborator. Run the full clean_author_names split at
ingest and emit one PersonInfo per segment per position, matching the
infobox author semantics. name_cn cannot be attributed to individual
segments reliably, so it is kept only for single-segment names.
… names only Not every author has a standalone person record on Bangumi, so sourcing authors from staffs alone would silently drop them. The online flows now use to_*_persons_online: authors are still extracted from the infobox (roles, multi-value splitting unchanged) and structured persons only map display names via name_cn when the infobox name matches a person with an author-class position (2001/2002/2003/2007/2009/2010) — the same boundary publishers already follow. Archive paths keep persons-primary semantics via to_*_persons.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(原 #24,已 rebase 到 master 重开)
概要
利用 Next API 的
GET /p1/subjects/{id}/staffs/persons结构化人物关联,把 archive 离线路径的 person 增强平移到在线路径。内容
BangumiClient::get_subject_staffs(分页 limit=100,页间限流),NextSubjectStaff→ archive 同构PersonInfo:一人多职务拆多条(作者 2001 + 原作 2007 → 两行),nameCN/career/appearEps透出name/nameCN跑共享清理链(cleaned_person_name):实测 API 的 nameCN 常带消歧注记("星野真(动画人)"),不清理则publisher_display_name的精确匹配静默失效get_series_metadata/match_series_metadata→to_series_metadata_persons;get_book_metadata→to_book_metadata_persons(单行本无自身人物关联时回退系列 staffs,对齐 archive 语义)边界:出版社分类不变
实测确认结构化数据不分原版/代理版:ONE PIECE 的 5 家出版社全部平铺 position=2004 且顺序不分主次(集英社排最后)。因此
Original/Localized分类仍由 infobox「出版社」/「其他出版社」键语义唯一决定,2004 条目仅参与publisher_display_name的name_cn显示名映射——与 archive 路径同一边界。已知缺口
在线路径不解析笔名(
pen_name置空):staffs 返回的 SlimPerson 不含 infobox 别名,笔名需逐人调/p1/persons/{id}(N+1)。实测 wiki 惯例是条目直接挂笔名记录(如链锯人挂「藤本タツキ」而非本名「藤本樹」),影响面小;如需补齐可作后续(仅对作者职务 person 拉详情)。测试
next_staffs_adapt_persons:多职务拆分、出版社 2004、nameCN 注记剥除、publisher_display_name匹配闭环cargo test -p komf-core:287 passed / 0 failed;clippy 无新增警告;rustfmt 干净