feat: M2 (part 2) — RSS poller, backfill, enrichment, scheduler
- Free per-channel RSS reader for quota-less fresh-video detection
- Recent-first backfill (configurable: 100 videos / 1 year) plus resumable deep
backfill from the uploads playlist
- Enrichment via videos.list: duration, view/like counts, category, topics,
language, Shorts heuristic and livestream/premiere classification
- Reusable sync runners + APScheduler jobs (rss / enrich / backfill), all
quota-aware with a reserve so backfill never starves fresh enrichment
- Manual triggers: POST /api/sync/{rss,backfill,enrich}
- Exact insert counting via RETURNING with in-batch de-duplication
This commit is contained in:
+13
-1
@@ -1,3 +1,4 @@
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI
|
||||
@@ -9,8 +10,19 @@ from starlette.middleware.sessions import SessionMiddleware
|
||||
from app import auth
|
||||
from app.config import settings
|
||||
from app.routes import health, sync
|
||||
from app.scheduler import shutdown_scheduler, start_scheduler
|
||||
|
||||
app = FastAPI(title=settings.app_name)
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
start_scheduler()
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
shutdown_scheduler()
|
||||
|
||||
|
||||
app = FastAPI(title=settings.app_name, lifespan=lifespan)
|
||||
|
||||
app.add_middleware(
|
||||
SessionMiddleware,
|
||||
|
||||
Reference in New Issue
Block a user