mb_confidence now working as a variable.

The value from config.ini is returned as a string. It needs to be cast to an int before use.
This commit is contained in:
2024-09-20 13:17:35 -04:00
parent 370151373c
commit 3eb993e3c4
2 changed files with 9 additions and 5 deletions

View File

@@ -8,13 +8,15 @@ def get_mb_id(artist_name, mb_confidence):
mb_data = response.json()
if mb_data['count'] > 0:
if mb_data['artists'][0]['score'] > mb_confidence:
return mb_data['artists'][0]['id']
return True, mb_data['artists'][0]['id']
else:
print("No artist found of hight enough confidance.")
else:
print("No artist found.")
return False, ""
else:
print(f"Error: {response.status_code}")
return False, ""
def get_image(mb_id, ftv_api_key, artist_path):
ftv_api_url = f'https://webservice.fanart.tv/v3/music/{mb_id}?api_key={ftv_api_key}'