This commit is contained in:
eric
2026-03-28 17:49:04 -05:00
parent e050afbac1
commit 513c2b7b8c
3 changed files with 45 additions and 4 deletions

View File

@@ -24,7 +24,25 @@ REMOTE_BASE = os.environ.get("LIVE_DEPLOY_PATH", "/home/live/douyinyoutube").rst
REPO_ROOT = Path(__file__).resolve().parent.parent
def _discover_repo_files() -> list[str]:
"""与 youtube.py 运行相关的源码,避免只同步白名单时缺模块。"""
extra: list[str] = []
backup_dir = REPO_ROOT / "backup"
if backup_dir.is_dir():
for p in sorted(backup_dir.glob("*.py")):
extra.append(str(p.relative_to(REPO_ROOT)).replace("\\", "/"))
return extra
FILES = [
"src/utils.py",
"src/logger.py",
"src/spider.py",
"src/stream.py",
"src/proxy.py",
"src/http_clients/async_http.py",
"src/http_clients/sync_http.py",
"src/android_control.py",
"src/async_thread_loop.py",
"src/youtube_ini_sync.py",
@@ -37,6 +55,7 @@ FILES = [
"youtube.py",
"tiktok.py",
"main.py",
"ffmpeg_install.py",
"scripts/hardware_probe.py",
"config/hardware.env.example",
"ecosystem.config.cjs",
@@ -73,6 +92,8 @@ FILES = [
"web-console/components/console/LiveConsoleWorkspace.tsx",
]
FILES = sorted(set(FILES + _discover_repo_files()))
LOG_DIR = REPO_ROOT / ".deploy_logs"
TAIL_LINES = 90
@@ -229,8 +250,26 @@ def main() -> int:
sftp_put(sftp, lp, rp)
_safe_print(f"已上传: {rel}")
run_logged(
client,
log_path,
"clear_python_caches",
f"rm -rf {REMOTE_BASE}/src/__pycache__ {REMOTE_BASE}/backup/__pycache__ 2>/dev/null; echo cache_cleared",
timeout=20,
)
run_logged(
client,
log_path,
"verify_utils_py_snippet",
f"sed -n '1,28p' {REMOTE_BASE}/src/utils.py",
timeout=15,
)
py_compile = (
f"cd {REMOTE_BASE} && python3 -m py_compile web.py youtube.py tiktok.py "
f"cd {REMOTE_BASE} && python3 -m py_compile web.py youtube.py tiktok.py ffmpeg_install.py "
"backup/__init__.py backup/msg_push.py backup/robust_relay.py "
"src/utils.py src/logger.py src/spider.py src/stream.py src/proxy.py "
"src/http_clients/async_http.py src/http_clients/sync_http.py "
"src/control_plane.py src/web_process_backend.py src/hub_routes.py "
"src/async_thread_loop.py src/youtube_ini_sync.py "
"src/live_config/__init__.py src/live_config/loader.py "