Remove Listen page, tighten Bandcamp matching to 75%+ artist similarity

This commit is contained in:
root
2026-03-31 00:10:15 -05:00
parent 1efa5cd628
commit 789de25c1a
6 changed files with 9 additions and 381 deletions

View File

@@ -32,21 +32,16 @@ async def search_bandcamp_verified(artist: str, title: str) -> dict | None:
for r in results:
artist_sim = _similarity(r.get("artist", ""), artist)
title_sim = _similarity(r.get("title", ""), title)
# Require artist to be a strong match (>0.6) and title reasonable (>0.4)
if artist_sim >= 0.6 and title_sim >= 0.4:
return r
# Or if artist is very close, accept even if title differs (different track by same artist)
if artist_sim >= 0.8:
# Require artist to be a strong match (>0.75) AND title reasonable (>0.5)
if artist_sim >= 0.75 and title_sim >= 0.5:
return r
# Try artist/band search as fallback
# Try artist/band search as fallback — very strict matching
results = await search_bandcamp(artist, item_type="b")
for r in results:
artist_sim = _similarity(r.get("title", ""), artist) # For band results, title IS the band name
if artist_sim >= 0.6:
return r
artist_sim = _similarity(r.get("artist", ""), artist)
if artist_sim >= 0.6:
# For band results, title IS the band name
name = r.get("title", "") or r.get("artist", "")
if _similarity(name, artist) >= 0.8:
return r
return None