feat(identify-words): 识别词——全局识别词(MP 语法)+ 作品识别词(季集换算),规则页「识别词」页签
- 新表 identify_words(0094):全局一块 + 每部作品一块原文,带版本与审计;episode_mapping_rule 转成文本行后删表
- 全局识别词移植 MP WordsMatcher(屏蔽 / 替换 / 集数偏移 / 替换+偏移 / {[tmdbid=…]}),所有按标题 / 文件名识别的地方解析前套用,命中的行记在解析结果上;保存后后台按改动行重新识别
- 作品识别词:S02 >> S01 EP+24 / S01E13 >> S00E01 / S01 @组 >> 忽略,解析器 + 打印器 + 编译;发布组繁简视为同一个
- 去掉规则自动停用:算出来对不上季表只待确认,要停用就注释掉那一行
- 集数待确认的采用 / 忽略与智能体 apply_rule 改为往作品识别词追加一行(带来历注释)
- 编辑器可视化 / 文本两种模式改同一份原文,保存前试算;作品页「集数映射」用同一个编辑器
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
This commit is contained in:
1 parent
12f8fc59c3
commit
63e94b308e
90 files changed
+6366
-2131
No files matched your search
@@ -1,51 +1,85 @@
|
||||
import { IdParam } from "../common.ts";
|
||||
import * as em from "../episode-mapping.ts";
|
||||
import * as iw from "../identify-words.ts";
|
||||
import { ep } from "./shared.ts";
|
||||
|
||||
// 集数映射(docs/plan/episode-resolution.md 批次 4):作品的映射规则增删改、模拟预览。
|
||||
// 写入后立即按作品重算已绑定资源(返回受影响数量);待处理 episode_mapping 的确认 / 忽略走 /decisions/{id}/resolve 的选项。
|
||||
// 识别词(docs/design/identify-words.md):全局一块、每部作品一块,原文整块读写;保存前试算,保存后重算。
|
||||
// 集数映射预览(纯读);集数待确认事项的确认 / 忽略走 /decisions/{id}/resolve 的选项(把一行写进作品识别词)。
|
||||
|
||||
export const episodeMappingApi = {
|
||||
episodeMapping: {
|
||||
listRules: ep({
|
||||
identifyWords: {
|
||||
getGlobal: ep({
|
||||
method: "get",
|
||||
path: "/media-entities/{id}/episode-mapping-rules",
|
||||
path: "/identify-words/global",
|
||||
scope: "read",
|
||||
summary: "作品的集数映射规则(含停用的与停用原因)",
|
||||
params: IdParam,
|
||||
response: em.EpisodeMappingRuleList,
|
||||
summary: "全局识别词原文、版本与保存后的重算进度",
|
||||
response: iw.IdentifyWordsBlock,
|
||||
}),
|
||||
createRule: ep({
|
||||
dryRunGlobal: ep({
|
||||
method: "post",
|
||||
path: "/media-entities/{id}/episode-mapping-rules",
|
||||
scope: "organize.execute",
|
||||
summary: "新建集数映射规则并按作品重算(同作品 + 季 + 发布组只能有一条启用的规则)",
|
||||
params: IdParam,
|
||||
body: em.EpisodeMappingRuleCreate,
|
||||
response: em.EpisodeMappingRuleWriteResult,
|
||||
path: "/identify-words/global/dry-run",
|
||||
scope: "read",
|
||||
summary: "试算全局识别词:逐行错误、改动的行、近期资源里识别结果会变的条目(纯读)",
|
||||
body: iw.IdentifyWordsDryRunInput,
|
||||
response: iw.GlobalWordsDryRun,
|
||||
}),
|
||||
updateRule: ep({
|
||||
method: "patch",
|
||||
path: "/episode-mapping-rules/{id}",
|
||||
scope: "organize.execute",
|
||||
summary: "修改 / 停用 / 启用集数映射规则并按作品重算",
|
||||
params: IdParam,
|
||||
body: em.EpisodeMappingRuleUpdate,
|
||||
response: em.EpisodeMappingRuleWriteResult,
|
||||
saveGlobal: ep({
|
||||
method: "put",
|
||||
path: "/identify-words/global",
|
||||
scope: "admin",
|
||||
summary: "保存全局识别词(版本不符返回 409),后台重新识别标题命中改动行的资源",
|
||||
body: iw.IdentifyWordsSave,
|
||||
response: iw.GlobalWordsSaveResult,
|
||||
}),
|
||||
deleteRule: ep({
|
||||
method: "delete",
|
||||
path: "/episode-mapping-rules/{id}",
|
||||
scope: "organize.execute",
|
||||
summary: "删除集数映射规则并按作品重算",
|
||||
params: IdParam,
|
||||
response: em.EpisodeMappingRuleWriteResult,
|
||||
listEntities: ep({
|
||||
method: "get",
|
||||
path: "/identify-words/entities",
|
||||
scope: "read",
|
||||
summary: "有作品识别词的作品:行数、停用行数、错误行数、最后修改",
|
||||
query: iw.EntityWordsListQuery,
|
||||
response: iw.EntityWordsList,
|
||||
}),
|
||||
try: ep({
|
||||
method: "post",
|
||||
path: "/identify-words/try",
|
||||
scope: "read",
|
||||
summary: "拿一个标题试一行识别词:替换后的标题、识别出的季集、作品识别词换算后的季集与校验(纯读)",
|
||||
body: iw.WordsTryInput,
|
||||
response: iw.WordsTryResult,
|
||||
}),
|
||||
getEntity: ep({
|
||||
method: "get",
|
||||
path: "/media-entities/{id}/identify-words",
|
||||
scope: "read",
|
||||
summary: "作品识别词原文与版本,附这部作品资源里出现过的发布组",
|
||||
params: IdParam,
|
||||
response: iw.EntityWordsView,
|
||||
}),
|
||||
dryRunEntity: ep({
|
||||
method: "post",
|
||||
path: "/media-entities/{id}/identify-words/dry-run",
|
||||
scope: "read",
|
||||
summary: "试算作品识别词:逐行错误、近期资源换算前后与仍对不上季表的条目(纯读)",
|
||||
params: IdParam,
|
||||
body: iw.IdentifyWordsDryRunInput,
|
||||
response: iw.EntityWordsDryRun,
|
||||
}),
|
||||
saveEntity: ep({
|
||||
method: "put",
|
||||
path: "/media-entities/{id}/identify-words",
|
||||
scope: "organize.execute",
|
||||
summary: "保存作品识别词(版本不符返回 409),按作品重算已绑定资源的集数",
|
||||
params: IdParam,
|
||||
body: iw.IdentifyWordsSave,
|
||||
response: iw.EntityWordsSaveResult,
|
||||
}),
|
||||
},
|
||||
episodeMapping: {
|
||||
preview: ep({
|
||||
method: "post",
|
||||
path: "/media-entities/{id}/episode-mapping/preview",
|
||||
scope: "read",
|
||||
summary: "模拟预览:近期资源的原始季集 → 当前结果 → 套用草稿规则后的结果(纯读)",
|
||||
summary: "模拟预览:近期资源的原始季集 → 当前结果 → 套用草稿识别词后的结果(纯读)",
|
||||
params: IdParam,
|
||||
body: em.EpisodeMappingPreviewInput,
|
||||
response: em.EpisodeMappingPreview,
|
||||
|
||||
Reference in new issue
Block a user