feat(p1): add daily snapshots and fan tracking

Implement P1: seven-metric view snapshots, relation/stat fan snapshots, failure placeholders, resume by daily completion markers, Cookie login warnings, daily SQLite backups, Shanghai daily scheduling, and CLI snapshot/auth-check commands. Real read-only run captured 795/795 videos successfully over 1124s with a verified daily backup.
This commit is contained in:
kairee committed 2026-10-31 19:19:24 +08:00
1 parent ee289bfa56
commit 5c2ab7b187
20 files changed
+1680 -54

No files matched your search

+20
View File
@@ -7,6 +7,7 @@
from __future__ import annotations
import os
import queue
import sqlite3
import threading
@@ -165,6 +166,25 @@ class Database:
finally:
conn.close()
def backup_to(self, target: str | Path) -> Path:
"""用 SQLite backup API 生成一致性备份;先写临时文件再原子替换。"""
target = Path(target)
target.parent.mkdir(parents=True, exist_ok=True)
tmp = target.with_name(target.name + ".tmp")
if tmp.exists():
tmp.unlink()
def run(conn: sqlite3.Connection) -> None:
dst = sqlite3.connect(tmp)
try:
conn.backup(dst)
finally:
dst.close()
self.write(run)
os.replace(tmp, target)
return target
def close(self) -> None:
if self._closed:
return