Add mb_confidence as a configurable variable.
Update the project main and api_calls.py to get and use a confidence value set in config.ini.
This commit is contained in:
+2
-2
@@ -1,13 +1,13 @@
|
||||
import requests
|
||||
import os
|
||||
|
||||
def get_mb_id(artist_name):
|
||||
def get_mb_id(artist_name, mb_confidence):
|
||||
mb_url = f'https://musicbrainz.org/ws/2/artist?query=artist:%22{artist_name}%22&fmt=json'
|
||||
response = requests.get(mb_url)
|
||||
if response.status_code == 200:
|
||||
mb_data = response.json()
|
||||
if mb_data['count'] > 0:
|
||||
if mb_data['artists'][0]['score'] > 80:
|
||||
if mb_data['artists'][0]['score'] > mb_confidence:
|
||||
return mb_data['artists'][0]['id']
|
||||
else:
|
||||
print("No artist found of hight enough confidance.")
|
||||
|
||||
Reference in New Issue
Block a user