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)
This commit is contained in:
@@ -26,6 +26,7 @@ async def search_bandcamp_verified(artist: str, title: str) -> dict | None:
|
||||
"""Search Bandcamp and only return a result if the artist actually matches.
|
||||
|
||||
Returns the best matching result or None if no good match found.
|
||||
First tries artist+song, then falls back to artist-only search.
|
||||
"""
|
||||
# Try track search first: "artist title"
|
||||
results = await search_bandcamp(f"{artist} {title}", item_type="t")
|
||||
@@ -36,12 +37,12 @@ async def search_bandcamp_verified(artist: str, title: str) -> dict | None:
|
||||
if artist_sim >= 0.75 and title_sim >= 0.5:
|
||||
return r
|
||||
|
||||
# Try artist/band search as fallback — very strict matching
|
||||
# Try artist/band search as fallback — return their artist page URL
|
||||
results = await search_bandcamp(artist, item_type="b")
|
||||
for r in results:
|
||||
# For band results, title IS the band name
|
||||
name = r.get("title", "") or r.get("artist", "")
|
||||
if _similarity(name, artist) >= 0.8:
|
||||
if _similarity(name, artist) >= 0.7:
|
||||
return r
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user