2026-04-08 19:54:18 +08:00
|
|
|
|
"""独立进程:仅根据 .env / 环境变量中的 action_watch_dir 跑目录监控(不启动 FastAPI)。"""
|
|
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
2026-04-09 11:54:30 +08:00
|
|
|
|
from app.db import init_db
|
2026-04-08 19:54:18 +08:00
|
|
|
|
from app.services.action_watch import run_action_watch_loop
|
|
|
|
|
|
from app.settings import get_settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main() -> None:
|
|
|
|
|
|
s = get_settings()
|
2026-04-09 11:54:30 +08:00
|
|
|
|
init_db(s)
|
2026-04-08 19:54:18 +08:00
|
|
|
|
if s.action_watch_dir is None:
|
|
|
|
|
|
print(
|
|
|
|
|
|
"未配置监控目录:请在 .env 中设置 ACTION_WATCH_DIR=/你的/mp4/目录",
|
|
|
|
|
|
file=sys.stderr,
|
|
|
|
|
|
)
|
|
|
|
|
|
raise SystemExit(1)
|
|
|
|
|
|
asyncio.run(run_action_watch_loop(s))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
main()
|