Verify Bandcamp results match the actual artist/track before including
This commit is contained in:
@@ -158,7 +158,7 @@ Return ONLY the JSON array, no other text."""
|
||||
except json.JSONDecodeError:
|
||||
return [], remaining
|
||||
|
||||
from app.services.bandcamp import search_bandcamp
|
||||
from app.services.bandcamp import search_bandcamp_verified
|
||||
|
||||
# Save to DB — in bandcamp mode, only keep results verified on Bandcamp
|
||||
recommendations = []
|
||||
@@ -169,16 +169,13 @@ Return ONLY the JSON array, no other text."""
|
||||
bandcamp_url = None
|
||||
if bandcamp_mode:
|
||||
try:
|
||||
results = await search_bandcamp(
|
||||
f"{rec.get('artist', '')} {rec.get('title', '')}", item_type="t"
|
||||
match = await search_bandcamp_verified(
|
||||
rec.get("artist", ""), rec.get("title", "")
|
||||
)
|
||||
if not results:
|
||||
# Try artist-only search as fallback
|
||||
results = await search_bandcamp(rec.get("artist", ""), item_type="b")
|
||||
if results:
|
||||
bandcamp_url = results[0].get("bandcamp_url")
|
||||
if match:
|
||||
bandcamp_url = match.get("bandcamp_url")
|
||||
else:
|
||||
# Not on Bandcamp — skip this recommendation
|
||||
# Not verified on Bandcamp — skip
|
||||
continue
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user