Skip to content

Commit 01adce4

Browse files
committed
fix: 修复 Novel 2.0 路径和 README 自动更新集成
问题: 1. update_sources.py 使用旧路径 sources/legado/full.json 2. update-readme.yml 使用旧路径 3. Novel 2.0 工作流未集成 README 更新 修复: 1. update_sources.py 改用新路径 sources/legado/main/full.json(兼容旧路径) 2. update-readme.yml 改用新路径(兼容旧路径) 3. initialize.yml 和 daily-maintenance.yml 集成 update_sources.py 测试结果: - ✓ 正确读取 1000 个书源 - ✓ 兼容旧路径(向后兼容) - ✓ 自动更新 README、docs/index.html、STATS.md
1 parent 2fd9816 commit 01adce4

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.github/workflows/daily-maintenance.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ jobs:
8383
git config --local user.email "github-actions[bot]@users.noreply.github.com"
8484
git config --local user.name "github-actions[bot]"
8585
86+
# 更新 README 和站点数据
87+
python3 scripts/update_sources.py --base-dir .
88+
8689
git add sources/legado/main/full.json
8790
git add sources/legado/main/backups/
8891
git add sources/legado/main/metadata.json
92+
git add README.md docs/index.html STATS.md 2>/dev/null || true
8993
9094
git commit -m "chore: 日常维护 - 替换 ${{ steps.health.outputs.replaced_count || '0' }} 个失效书源" || echo "No changes to commit"
9195

.github/workflows/initialize.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ jobs:
6767
git config --local user.email "github-actions[bot]@users.noreply.github.com"
6868
git config --local user.name "github-actions[bot]"
6969
70+
# 更新 README 和站点数据
71+
python3 scripts/update_sources.py --base-dir .
72+
7073
git add sources/legado/main/full.json
7174
git add sources/legado/main/backups/
7275
git add sources/legado/pool/candidates.json
7376
git add sources/legado/pool/invalid.json
77+
git add README.md docs/index.html STATS.md 2>/dev/null || true
7478
7579
git commit -m "feat: 初始化书源系统 - 从 16,724 个筛选出 ${{ github.event.inputs.target || '1000' }} 个高质量书源" || echo "No changes to commit"
7680

.github/workflows/update-readme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
7070
# 获取当前书源数量
7171
cd scripts
72-
LEGADO_COUNT=$(python3 -c "import json; f=open('../sources/legado/full.json','r',encoding='utf-8'); print(len(json.load(f)))" 2>/dev/null || echo "0")
72+
LEGADO_COUNT=$(python3 -c "import json; f=open('../sources/legado/main/full.json','r',encoding='utf-8'); print(len(json.load(f)))" 2>/dev/null || python3 -c "import json; f=open('../sources/legado/full.json','r',encoding='utf-8'); print(len(json.load(f)))" 2>/dev/null || echo "0")
7373
XSREADER_COUNT=$(python3 -c "import os; print(os.path.getsize('../sources/xsreader/full.xbs')//(9*1024))" 2>/dev/null || echo "0")
7474
cd ..
7575

scripts/update_sources.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ def __init__(self, base_dir: Path):
2424

2525
def count_legado_sources(self) -> int:
2626
"""统计阅读书源数量"""
27-
legado_file = self.sources_dir / "legado/full.json"
27+
# Novel 2.0: 使用新的三层架构路径
28+
legado_file = self.sources_dir / "legado/main/full.json"
2829

2930
if not legado_file.exists():
30-
return 0
31+
# 兼容旧路径
32+
legado_file = self.sources_dir / "legado/full.json"
33+
if not legado_file.exists():
34+
return 0
3135

3236
try:
3337
with open(legado_file, 'r', encoding='utf-8') as f:

0 commit comments

Comments
 (0)