diff --git a/app/routers/router_recommendations.py b/app/routers/router_recommendations.py index 43f9d5b..69cff44 100644 --- a/app/routers/router_recommendations.py +++ b/app/routers/router_recommendations.py @@ -28,6 +28,7 @@ async def get_recommendations( request: Request, limit: int = 15, html: bool = Query(False), + content_type: Optional[str] = Query(None, description="Filter: 'anime', 'series', or None for all"), current_user: Optional[User] = Depends(get_optional_user), ): """Get personalized anime recommendations based on download history""" @@ -45,6 +46,10 @@ async def get_recommendations( try: recommendations = await engine.get_personalized_recommendations(limit=limit) + + # Filter by content_type if specified + if content_type and content_type != "all": + recommendations = [r for r in recommendations if r.get("content_type", r.get("type", "")) == content_type] if html or is_htmx: return templates.TemplateResponse( @@ -66,12 +71,17 @@ async def get_latest_releases( request: Request, limit: int = 20, html: bool = Query(False), + content_type: Optional[str] = Query(None, description="Filter: 'anime', 'series', or None for all"), ): """Get latest anime releases""" from app.recommendations import get_latest_releases_with_info try: releases = await get_latest_releases_with_info(limit=limit) + + # Filter by content_type if specified + if content_type and content_type != "all": + releases = [r for r in releases if r.get("content_type", r.get("type", "")) == content_type] if html or request.headers.get("HX-Request"): return templates.TemplateResponse( diff --git a/templates/index.html b/templates/index.html index d006eb6..ee40a6d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -12,7 +12,7 @@