feat: 重构图书墙交互及多源高阶信息抓取注入系统

1. UI 层:
- 抛弃网格卡片结构,改版为沉浸式的“图书墙”(1:1.43 原比例包含模式)。
- 新增悬浮深色遮罩系统(hover-details),解绑评分点击阻塞。
- 过滤系统默认进入“在读”状态页,彻底移除冗余无效的全选按钮。
2. 抓取与刮削层 (scrape.py):
- 抛弃对 ISBN 查询 Google Books 的严重强依赖。
- 重构抓取链路,首选 Goodreads 与特供的 Books.com.tw(博客来) 高精爬取港台原版资料。
- 建立 Amazon/Goodreads 图片去码净化正则,告别低分辨率与畸形图片。
- 修复 bs4 (.select_first) 解析选择器在旧版环境的兼容性异常。
3. Agent AI 数据管线设计 (bookshelf.py):
- 开放基于 --json 与 --cover 的强力直接注入功能。
- 升级 add 命令作为最优先级的录入手段,免去繁琐的 enrich 阶段,直接连带高清图和满载元数据强插。
- 建立入库反重名智能拦截 (title + author 交叉校验),形成完美的防呆与自动化壁垒。
This commit is contained in:
kai
2026-03-26 11:42:43 +08:00
parent 69c34d4faf
commit 0801f7c7df
9 changed files with 684 additions and 133 deletions
+12 -5
View File
@@ -54,6 +54,10 @@ def init_db():
("read_order", "INTEGER"),
("cover_blob", "BLOB"),
("cover_local", "TEXT DEFAULT ''"),
("title_en", "TEXT DEFAULT ''"),
("author_en", "TEXT DEFAULT ''"),
("douban_url", "TEXT DEFAULT ''"),
("goodreads_url","TEXT DEFAULT ''"),
]
for col_name, col_def in new_cols:
plain = col_name.strip('"')
@@ -67,19 +71,22 @@ def add_book(title, *, author=None, translator=None, publisher=None,
pub_date=None, cover_url=None, format="paper", status="to-read",
rating=None, douban_score=None, goodreads_score=None,
tags="", notes=None, start_date=None, finish_date=None,
group="", isbn="", priority="", read_reason="", read_order=None):
group="", isbn="", priority="", read_reason="", read_order=None,
title_en="", author_en="", douban_url="", goodreads_url=""):
"""添加一本书,返回新书 ID。"""
conn = _connect()
cur = conn.execute("""
INSERT INTO books (title, author, translator, publisher, pub_date,
cover_url, format, status, rating, douban_score,
goodreads_score, tags, notes, start_date, finish_date,
"group", isbn, priority, read_reason, read_order)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"group", isbn, priority, read_reason, read_order,
title_en, author_en, douban_url, goodreads_url)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", (title, author, translator, publisher, pub_date, cover_url,
format, status, rating, douban_score, goodreads_score,
tags, notes, start_date, finish_date,
group, isbn, priority, read_reason, read_order))
group, isbn, priority, read_reason, read_order,
title_en, author_en, douban_url, goodreads_url))
conn.commit()
book_id = cur.lastrowid
conn.close()
@@ -95,7 +102,7 @@ def update_book(book_id, **kwargs):
"cover_url", "format", "status", "rating", "douban_score",
"goodreads_score", "tags", "notes", "start_date", "finish_date",
"group", "isbn", "priority", "read_reason", "read_order",
"cover_blob", "cover_local",
"cover_blob", "cover_local", "title_en", "author_en", "douban_url", "goodreads_url",
}
fields = {k: v for k, v in kwargs.items() if k in allowed}
if not fields: