Add runtime filter, kid-friendly toggle, surprise me, and re-roll

- Runtime quick-select buttons (Any/90m/2h/2.5h) filter movies by length
- Kid-friendly toggle forces PG-13 max and boosts Family/Animation genres
- Surprise Me picks a random mood prompt from 20 curated options
- Show Me More re-rolls same mood excluding already-shown movies
- Re-roll appends new results to the existing search history entry

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 20:07:05 -07:00
parent d8c8b473ad
commit 9f96a91986
6 changed files with 194 additions and 18 deletions
+7 -1
View File
@@ -98,7 +98,7 @@ def _parse_movie(raw: dict) -> Movie:
)
def prefilter_candidates(movies_raw: list[dict], mood: str, max_candidates: int = 200) -> list[Movie]:
def prefilter_candidates(movies_raw: list[dict], mood: str, max_candidates: int = 200, kid_friendly: bool = False) -> list[Movie]:
"""Score and filter movies based on mood signals. Returns top candidates as Movie models."""
mood_lower = mood.lower()
@@ -108,6 +108,12 @@ def prefilter_candidates(movies_raw: list[dict], mood: str, max_candidates: int
max_rating: str | None = None
decade = _parse_decade(mood)
# Kid-friendly toggle overrides
if kid_friendly:
max_rating = "PG-13"
boost_genres.update(["Family", "Animation", "Comedy", "Adventure"])
penalize_genres.update(["Horror", "Thriller"])
for keyword, signals in MOOD_SIGNALS.items():
if keyword in mood_lower:
boost_genres.update(signals["boost"])