#!/usr/bin/env python3 import asyncio, os, sys, logging REPO_ROOT = os.path.dirname(os.path.abspath(__file__)) ENV_PATH = os.path.join(REPO_ROOT, ".env") if os.path.exists(ENV_PATH): with open(ENV_PATH) as f: for line in f: line = line.strip() if line and not line.startswith("#") and "=" in line: key, _, value = line.partition("=") value = value.strip().strip("'\"") os.environ[key] = value sys.path.insert(0, REPO_ROOT) sys.path.insert(0, os.path.join(REPO_ROOT, "backend")) from backend.db import init_db from backend.fetcher import fetch_subscriptions from backend.summarizer import summarize_all_pending logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s") async def main(): await init_db() count = await fetch_subscriptions() print(f"Fetched {count} new videos") if count > 0: print(f"Summarizing {count} videos...") await summarize_all_pending() print("Done") if __name__ == "__main__": asyncio.run(main())