Files
vynl/backend/app/schemas/recommendation.py
root 240032d972 Add Bandcamp/YouTube links on all recs, Fix My Playlist, configurable rec count
- Bandcamp: match artist+song, fall back to artist-only page
- YouTube fallback: if not on Bandcamp, link to YouTube music video search
- Fix My Playlist: AI analyzes playlist, finds outliers, suggests replacements
- User chooses recommendation count (5, 10, 15, 20)
2026-03-31 08:45:02 -05:00

48 lines
1.3 KiB
Python

from datetime import datetime
from pydantic import BaseModel
class RecommendationRequest(BaseModel):
playlist_id: int | None = None
query: str | None = None # Manual search/request
bandcamp_mode: bool = False # Prioritize Bandcamp/indie artists
mode: str = "discover" # discover, sonic_twin, era_bridge, deep_cuts, rising
adventurousness: int = 3 # 1-5
exclude: str | None = None # comma-separated genres to exclude
count: int = 5 # Number of recommendations (5, 10, 15, 20)
class RecommendationItem(BaseModel):
id: int
title: str
artist: str
album: str | None = None
spotify_id: str | None = None
preview_url: str | None = None
image_url: str | None = None
bandcamp_url: str | None = None
youtube_url: str | None = None
reason: str
score: float | None = None
saved: bool = False
disliked: bool = False
created_at: datetime
model_config = {"from_attributes": True}
class RecommendationResponse(BaseModel):
recommendations: list[RecommendationItem]
remaining_this_week: int | None = None # None = unlimited (pro)
class TasteProfile(BaseModel):
top_genres: list[dict]
avg_energy: float
avg_danceability: float
avg_valence: float
avg_tempo: float
era_preferences: list[str]
mood_summary: str