feat: 图片下载与数据目录本地化
- 新增 download_images.py: 批量下载消息图片到 downloads/images/ - 数据库移至 downloads/messages.db,SnifferStorage 默认使用项目目录 - 图片默认保存到 downloads/images/,支持 --out-dir 自定义 - .gitignore 排除 downloads/ 避免提交二进制文件 - 补充腾讯会议号过滤 prompt - 补充 Obsidian 文档 is_read frontmatter
This commit is contained in:
35
tests/test_backfill.py
Normal file
35
tests/test_backfill.py
Normal file
@ -0,0 +1,35 @@
|
||||
from datetime import date
|
||||
|
||||
from backfill_summaries import missing_message_dates
|
||||
|
||||
|
||||
def test_backfill_skips_empty_days_and_existing_nonempty_summaries(tmp_path):
|
||||
messages = {date(2024, 6, 2), date(2024, 6, 3), date(2024, 6, 4)}
|
||||
existing = tmp_path / "2024-06-03.md"
|
||||
existing.write_text("已有日报", encoding="utf-8")
|
||||
empty = tmp_path / "2024-06-04.md"
|
||||
empty.touch()
|
||||
|
||||
days = list(missing_message_dates(
|
||||
date(2024, 6, 1),
|
||||
date(2024, 6, 5),
|
||||
lambda day: day in messages,
|
||||
lambda day: tmp_path / f"{day.isoformat()}.md",
|
||||
))
|
||||
|
||||
assert days == [date(2024, 6, 2), date(2024, 6, 4)]
|
||||
|
||||
|
||||
def test_backfill_overwrite_still_skips_days_without_messages(tmp_path):
|
||||
output = tmp_path / "2024-06-02.md"
|
||||
output.write_text("旧日报", encoding="utf-8")
|
||||
|
||||
days = list(missing_message_dates(
|
||||
date(2024, 6, 2),
|
||||
date(2024, 6, 2),
|
||||
lambda day: True,
|
||||
lambda day: output,
|
||||
overwrite=True,
|
||||
))
|
||||
|
||||
assert days == [date(2024, 6, 2)]
|
||||
Reference in New Issue
Block a user