Pass lastfm api_key when enriching source-only artist response

LastFMClient() with no args has no api_key -> get_artist_info silently
returns None -> source artists never see bio/listeners/playcount even
though my previous commit was supposedly fetching them.

Now reads config_manager.get('lastfm.api_key') and only attempts the
enrichment when the key is configured. Users without Last.fm credentials
in Settings simply get image+name+badges+genres on source artists
(everything except bio + stats), which is fine.
This commit is contained in:
Broque Thomas 2026-04-22 17:22:11 -07:00
parent f936b8cb12
commit 5c94b87aea

View file

@ -11399,9 +11399,10 @@ def _build_source_only_artist_detail(artist_id, artist_name, source):
lastfm_url = None
if resolved_name:
try:
from core.lastfm_client import LastFMClient
lastfm = LastFMClient()
if lastfm and getattr(lastfm, 'enabled', True):
lastfm_api_key = config_manager.get('lastfm.api_key', '') or ''
if lastfm_api_key:
from core.lastfm_client import LastFMClient
lastfm = LastFMClient(api_key=lastfm_api_key)
lf_info = lastfm.get_artist_info(resolved_name)
if lf_info:
bio_obj = lf_info.get('bio') or {}