5 Commits

Author SHA1 Message Date
cbde52eb59 Merge branch 'master' into ratelimiting 2024-10-14 11:17:37 -04:00
883f594f4f Fix the output path of Artist Background.
The artist background had been saving to the folder the script was run from. This has now been resolved.
2024-10-14 11:08:17 -04:00
c5ffadd1f0 Get the artist background.
Adds the artist background as a possible source of artist image.
2024-10-14 10:34:43 -04:00
485b565a3f Replace working code in empty file.
api_calls.py had been emptied for some reason. Probably an acidential deletion. The old code has now been placed in the file.
2024-10-13 17:38:03 -04:00
386f17779b Changes the internal ratelimiting scheme.
Rather than ratelimit to one request per-second, attempt to detect the
MusicBrainz API ratelimiting. The API will return HTTP 503 errors once
ratelimiting has begun. Once this has been detected, the script will wait 1
second before continuing processing.
2024-10-03 14:53:52 -04:00
2 changed files with 7 additions and 1 deletions

View File

@@ -32,6 +32,12 @@ def get_image(mb_id, ftv_api_key, artist_path):
if response.status_code == 200: if response.status_code == 200:
with open(os.path.join(artist_path, 'artist.jpg'), 'wb') as f: with open(os.path.join(artist_path, 'artist.jpg'), 'wb') as f:
f.write(response.content) f.write(response.content)
elif ('artistbackground' in ftv_data):
art_url = ftv_data['artistbackground'][0]['url']
response = requests.get(art_url)
if (response.status_code == 200):
with open(os.path.join(artist_path, 'artist.jpg'),'wb') as f:
f.write(response.content)
elif ('hdmusiclogo' in ftv_data): elif ('hdmusiclogo' in ftv_data):
art_url = ftv_data['hdmusiclogo'][0]['url'] art_url = ftv_data['hdmusiclogo'][0]['url']
response = requests.get(art_url) response = requests.get(art_url)

View File

@@ -39,4 +39,4 @@ for artist in dir_list:
print(e) print(e)
count += 1 count += 1
sleep(1) #sleep(1)