Add Concert Finder and Rabbit Hole features
- Concert Finder: Bandsintown API integration to find upcoming shows for recommended artists, with expandable tour dates section on recommendation cards - Rabbit Hole: Multi-step guided discovery journey where each song connects to the next through a shared musical quality (producer, influence, tone, etc.) - New /rabbit-hole route with seed input, step count selector, and vertical chain visualization of connected songs - Added concerts endpoint, rabbit hole endpoint, and corresponding frontend API functions and navigation
This commit is contained in:
42
backend/app/api/endpoints/concerts.py
Normal file
42
backend/app/api/endpoints/concerts.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from urllib.parse import quote
|
||||
|
||||
import httpx
|
||||
from fastapi import APIRouter, Depends, Query
|
||||
|
||||
from app.core.security import get_current_user
|
||||
from app.models.user import User
|
||||
|
||||
router = APIRouter(prefix="/concerts", tags=["concerts"])
|
||||
|
||||
|
||||
@router.get("")
|
||||
async def find_concerts(
|
||||
artist: str = Query(...),
|
||||
user: User = Depends(get_current_user),
|
||||
):
|
||||
"""Find upcoming concerts for an artist using Bandsintown API."""
|
||||
url = f"https://rest.bandsintown.com/artists/{quote(artist)}/events"
|
||||
async with httpx.AsyncClient(timeout=10) as client:
|
||||
resp = await client.get(url, params={"app_id": "vynl", "date": "upcoming"})
|
||||
|
||||
if resp.status_code != 200:
|
||||
return {"events": []}
|
||||
|
||||
events = resp.json()
|
||||
if not isinstance(events, list):
|
||||
return {"events": []}
|
||||
|
||||
return {
|
||||
"artist": artist,
|
||||
"events": [
|
||||
{
|
||||
"date": e.get("datetime", ""),
|
||||
"venue": e.get("venue", {}).get("name", ""),
|
||||
"city": e.get("venue", {}).get("city", ""),
|
||||
"region": e.get("venue", {}).get("region", ""),
|
||||
"country": e.get("venue", {}).get("country", ""),
|
||||
"url": e.get("url", ""),
|
||||
}
|
||||
for e in events[:10]
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user