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:
parent
f936b8cb12
commit
5c94b87aea
1 changed files with 4 additions and 3 deletions
|
|
@ -11399,9 +11399,10 @@ def _build_source_only_artist_detail(artist_id, artist_name, source):
|
||||||
lastfm_url = None
|
lastfm_url = None
|
||||||
if resolved_name:
|
if resolved_name:
|
||||||
try:
|
try:
|
||||||
from core.lastfm_client import LastFMClient
|
lastfm_api_key = config_manager.get('lastfm.api_key', '') or ''
|
||||||
lastfm = LastFMClient()
|
if lastfm_api_key:
|
||||||
if lastfm and getattr(lastfm, 'enabled', True):
|
from core.lastfm_client import LastFMClient
|
||||||
|
lastfm = LastFMClient(api_key=lastfm_api_key)
|
||||||
lf_info = lastfm.get_artist_info(resolved_name)
|
lf_info = lastfm.get_artist_info(resolved_name)
|
||||||
if lf_info:
|
if lf_info:
|
||||||
bio_obj = lf_info.get('bio') or {}
|
bio_obj = lf_info.get('bio') or {}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue