Wire Bandcamp into AI recommendations - prioritize indie artists, attach Bandcamp links to results
This commit is contained in:
@@ -129,7 +129,7 @@ Respond with exactly 5 music recommendations as a JSON array. Each item should h
|
||||
- "reason": A warm, personal 2-3 sentence explanation of WHY they'll love this track. Reference specific qualities from their taste profile. Be specific about sonic qualities, not generic.
|
||||
- "score": confidence score 0.0-1.0
|
||||
|
||||
Focus on discovery - prioritize lesser-known artists, deep cuts, and hidden gems over obvious popular choices.
|
||||
IMPORTANT: Strongly prioritize independent and underground artists who release music on Bandcamp. Think DIY, indie labels, self-released artists, and the kind of music you'd find crate-digging on Bandcamp. Mix in some Bandcamp-type artists alongside any well-known recommendations. Focus on real discovery — lesser-known artists, deep cuts, and hidden gems over obvious popular choices.
|
||||
Return ONLY the JSON array, no other text."""
|
||||
|
||||
# Call Claude API
|
||||
@@ -152,9 +152,22 @@ Return ONLY the JSON array, no other text."""
|
||||
except json.JSONDecodeError:
|
||||
return [], remaining
|
||||
|
||||
# Search Bandcamp for each recommendation to attach real links
|
||||
from app.services.bandcamp import search_bandcamp
|
||||
|
||||
# Save to DB
|
||||
recommendations = []
|
||||
for rec in recs_data[:5]:
|
||||
bandcamp_url = None
|
||||
try:
|
||||
results = await search_bandcamp(
|
||||
f"{rec.get('artist', '')} {rec.get('title', '')}", item_type="t"
|
||||
)
|
||||
if results:
|
||||
bandcamp_url = results[0].get("bandcamp_url")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
r = Recommendation(
|
||||
user_id=user.id,
|
||||
playlist_id=playlist_id,
|
||||
@@ -164,6 +177,7 @@ Return ONLY the JSON array, no other text."""
|
||||
reason=rec.get("reason", ""),
|
||||
score=rec.get("score"),
|
||||
query=query,
|
||||
bandcamp_url=bandcamp_url,
|
||||
)
|
||||
db.add(r)
|
||||
recommendations.append(r)
|
||||
|
||||
Reference in New Issue
Block a user