feat(sites): structure release detail pages and rework the detail drawer (DETAIL-1)
Adapters (pure functions + tests): - detail-description: strip HTML/BBCode residue, drop site template blocks and ad/signature lines (configurable rules), parse PT info blocks (◎ / 【】 / 『』 / 「键:」) into infoBlock and body paragraphs - mediainfo: MediaInfo and BDInfo (quick summary + full report) into a summary of container/duration/bitrate/size, video (HDR/DV), audio and subtitle tracks - file-tree: file list into a flattened directory tree with sizes and main/sample/subtitle/extra roles - formatDetailPage combines them; the server computes it when reading the cached detail page, so existing caches benefit without a refetch Contracts: SiteReleasePage gains infoBlock, paragraphs, media, fileTree. Web: drawer now reads top-down: meta row (promo/H&R, size, peers, upload time, IMDb/TMDB/豆瓣 tags) → 资料 → 简介 (collapsible) → 技术规格 (raw folded) → 截图 grid with keyboard lightbox → 文件 tree; inventory overlay moved into the fixed footer next to 下载. Fixtures: 6 desensitized samples from the local cache (site.detail and RSS descriptions) plus synthetic multi-track MediaInfo, BDInfo, bracket blocks and directory file lists. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c846e91cc4
commit
9be9813021
16 files changed
+1992
-175
No files matched your search
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 详情页扩展内容的展示结构(DETAIL-1):简介 → 信息块 + 段落,MediaInfo / BDInfo → 技术规格概要,文件清单 → 目录树。
|
||||
* 纯函数;服务端读缓存时现算(旧缓存也能用),原文(descriptionText / mediaInfo / files)照旧保留。
|
||||
*/
|
||||
import {
|
||||
DEFAULT_DESCRIPTION_RULES,
|
||||
type DescriptionRules,
|
||||
type DetailInfoItem,
|
||||
structureDescription,
|
||||
} from "./detail-description.ts";
|
||||
import { buildFileTree, type FileTreeRow } from "./file-tree.ts";
|
||||
import { type MediaSummary, parseMediaSummary } from "./mediainfo.ts";
|
||||
import type { SiteDetailPage } from "./types.ts";
|
||||
|
||||
export interface FormattedDetailPage {
|
||||
infoBlock: DetailInfoItem[];
|
||||
paragraphs: string[];
|
||||
media: MediaSummary | null;
|
||||
fileTree: FileTreeRow[];
|
||||
}
|
||||
|
||||
export function formatDetailPage(
|
||||
page: Pick<SiteDetailPage, "descriptionText" | "mediaInfo" | "files">,
|
||||
rules: DescriptionRules = DEFAULT_DESCRIPTION_RULES,
|
||||
): FormattedDetailPage {
|
||||
const { infoBlock, paragraphs } = structureDescription(page.descriptionText, rules);
|
||||
return {
|
||||
infoBlock,
|
||||
paragraphs,
|
||||
media: parseMediaSummary(page.mediaInfo),
|
||||
fileTree: buildFileTree(page.files ?? []),
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user