Nouvelle version réécrite de zéro : recherche multi-sources (Vostfree, French-Manga), extraction 2 niveaux, proxy vidéo intégré, streaming/téléchargement HLS, métadonnées Kitsu, bibliothèque locale, comptes JWT + administration, découverte fusionnée, indexeur Torznab (Sonarr/Prowlarr).
28 lines
1005 B
Python
28 lines
1005 B
Python
"""Découverte : nouveautés des sources, incontournables, recommandations."""
|
|
|
|
import logging
|
|
from typing import Annotated
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
|
|
from app.routers.auth import CurrentUser, current_user
|
|
from app.services.discover import discover
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
router = APIRouter(prefix="/api", tags=["discover"], dependencies=[Depends(current_user)])
|
|
|
|
|
|
@router.get("/discover")
|
|
async def get_discover(
|
|
user: CurrentUser,
|
|
latest_limit: Annotated[int, Query(ge=1, le=50)] = 24,
|
|
must_watch_limit: Annotated[int, Query(ge=1, le=20)] = 20,
|
|
for_you_limit: Annotated[int, Query(ge=1, le=20)] = 20,
|
|
) -> dict:
|
|
"""Les trois sections de découverte en une requête (sections vides si source KO)."""
|
|
must_watch = await discover.must_watch(must_watch_limit)
|
|
for_you = await discover.for_you(user.id, for_you_limit)
|
|
latest = await discover.latest(latest_limit)
|
|
return {"latest": latest, "must_watch": must_watch, "for_you": for_you}
|