This commit is contained in:
team3
2026-09-08 17:57:51 +02:00
parent 4de5018409
commit 13df86e9fc
12 changed files with 1088 additions and 90 deletions

View File

@@ -145,6 +145,75 @@ async def search_movies(q: str):
return await search.search(q.strip())
@app.get("/api/discover")
async def stoebern(
sort: str = "rating",
include: str = "",
exclude: str = "",
stimmen_min: int | None = None,
stimmen_max: int | None = None,
dauer_min: int | None = None,
dauer_max: int | None = None,
jahr_min: int | None = None,
jahr_max: int | None = None,
note_min: float | None = None,
note_max: float | None = None,
):
"""Suche ohne Suchbegriff: TMDB stöbert nach den Filtern der Leiste."""
return await search.discover(
{
"sort": sort,
"include": [g for g in include.split(",") if g],
"exclude": [g for g in exclude.split(",") if g],
"stimmen_min": stimmen_min,
"stimmen_max": stimmen_max,
"dauer_min": dauer_min,
"dauer_max": dauer_max,
"jahr_min": jahr_min,
"jahr_max": jahr_max,
"note_min": note_min,
"note_max": note_max,
}
)
@app.get("/api/movies/{movie_id}/aehnliche")
async def aehnliche_filme(
movie_id: int,
limit: int = 12,
voll: bool = False,
sort: str = "",
include: str = "",
exclude: str = "",
stimmen_min: int | None = None,
stimmen_max: int | None = None,
jahr_min: int | None = None,
jahr_max: int | None = None,
note_min: float | None = None,
note_max: float | None = None,
):
"""Was Leute noch geschaut haben, die diesen Film mochten."""
try:
return await search.aehnliche(
movie_id,
limit=limit,
voll=voll,
filter_={
"sort": sort,
"include": [g for g in include.split(",") if g],
"exclude": [g for g in exclude.split(",") if g],
"stimmen_min": stimmen_min,
"stimmen_max": stimmen_max,
"jahr_min": jahr_min,
"jahr_max": jahr_max,
"note_min": note_min,
"note_max": note_max,
},
)
except Exception:
return []
@app.get("/api/search/{movie_id}")
async def search_detail(movie_id: int):
"""Volle Daten zu einem Suchtreffer. Erst der Katalog, dann TMDB."""