This commit is contained in:
root
2026-05-17 04:31:59 +00:00
parent 75a0ca4e31
commit 07aa02bca6
51 changed files with 1322 additions and 435 deletions

View File

@@ -40,6 +40,7 @@ from src.async_thread_loop import run_async_coro
from src import spider, stream
from src.proxy import ProxyDetector
from src.runtime_bootstrap import load_msg_push_exports
from src.youtube_config_paths import resolve_youtube_style_config_paths
from src.youtube_runtime import normalize_youtube_video_save_type
from src.utils import logger
from src import utils
@@ -88,22 +89,8 @@ def _live_pm2_name() -> str:
def _youtube_pro_style_config_paths() -> tuple[str, str]:
"""每 PM2 进程独立 youtube.* / URL_config.*(与 web.py managed_*_relpath 一致);无 PM2 名时回落旧版共享文件"""
legacy_yt = f"{script_path}/config/youtube.ini"
legacy_url = f"{script_path}/config/URL_config.ini"
pm2 = _live_pm2_name()
if pm2:
low = pm2.lower()
if low.startswith("youtube") or low.startswith("douyin_youtube"):
safe = re.sub(r"[^a-zA-Z0-9_.-]", "_", pm2)
yp = f"{script_path}/config/youtube.{safe}.ini"
up = f"{script_path}/config/URL_config.{safe}.ini"
if os.path.isfile(yp) or os.path.isfile(up):
return yp, up
if os.path.isfile(legacy_yt) or os.path.isfile(legacy_url):
return legacy_yt, legacy_url
return yp, up
return legacy_yt, legacy_url
"""按文件粒度回退,避免只生成一半托管文件时把 legacy 配置绕掉"""
return resolve_youtube_style_config_paths(script_path, _live_pm2_name())
config_file, url_config_file = _youtube_pro_style_config_paths()