Refactor: modular main.py with selectable functions, save debug output to debug/ dir

This commit is contained in:
2025-12-29 01:09:59 +08:00
parent 283a035ab1
commit 04b7b3bb36
4 changed files with 253 additions and 61 deletions

View File

@@ -18,6 +18,8 @@ OrbitIn/
├── README.md # 项目说明
├── AGENTS.md # AI助手开发文档
├── layout_output.txt # 缓存的布局文本
├── debug/ # 调试输出目录
│ └── layout_output_*.txt # 带时间戳的调试文件
├── data/ # 数据目录
│ └── daily_logs.db # SQLite3 数据库
└── src/ # 代码模块
@@ -50,17 +52,29 @@ CONFLUENCE_API_TOKEN = "your-api-token"
### 使用方法
```bash
# 获取并处理数据(带数据库存储)
# 默认获取HTML、提取、解析并保存到数据库
python3 main.py
# 不存储到数据库
python3 main.py --no-db
# 仅获取HTML并提取文本保存到debug目录
python3 main.py fetch
# 获取并保存带时间戳的debug文件
python3 main.py fetch-debug
# 生成日报(指定日期)
python3 -c "from src.report import DailyReportGenerator; g = DailyReportGenerator(); g.print_report('2025-12-28'); g.close()"
python3 main.py report 2025-12-28
# 测试解析模块
python3 -c "from src.parser import HandoverLogParser; p = HandoverLogParser(); print(p.parse(open('layout_output.txt').read())[:3])"
# 生成今日日报
python3 main.py report-today
# 解析测试使用已有的layout_output.txt
python3 main.py parse-test
# 添加未统计数据
python3 main.py --unaccounted 118 --month 2025-12
# 显示帮助
python3 main.py --help
```
## 数据格式