Add ACTION_WATCH_* settings, background watch loop in FastAPI lifespan, and shared action_watch service that updates app_state. Add fish-action-watch CLI and optional FishAction watch_folder_predict.py for standalone use. Made-with: Cursor
25 lines
619 B
Python
25 lines
619 B
Python
"""独立进程:仅根据 .env / 环境变量中的 action_watch_dir 跑目录监控(不启动 FastAPI)。"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import asyncio
|
||
import sys
|
||
|
||
from app.services.action_watch import run_action_watch_loop
|
||
from app.settings import get_settings
|
||
|
||
|
||
def main() -> None:
|
||
s = get_settings()
|
||
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()
|