fixed networking and added handling for currently playing

This commit is contained in:
aj 2019-03-24 22:51:11 +00:00
parent f4415ec867
commit 7d23f6302d
2 changed files with 9 additions and 5 deletions

View File

@ -13,7 +13,7 @@ def exportScrobbles(scrobbles, path):
writer.writeheader()
for track in scrobbles:
if '@attr' not in track:
trackdict = {
'track':track['name'].replace(';', '_').replace(',', '_'),
'album':track['album']['#text'].replace(';', '_').replace(',', '_'),

View File

@ -21,10 +21,14 @@ class User:
}
data.update(extra)
req = requests.post('http://ws.audioscrobbler.com/2.0/', data = data)
req = requests.get('http://ws.audioscrobbler.com/2.0/', params = data)
if req.status_code < 200 or req.status_code > 299:
if req.json()['error'] == 8:
print('ERROR: retrying call ' + method)
return __makeRequest(method, extra, page)
else:
raise ValueError('HTTP Error Raised: ' + str(req.json()['error']) + ' ' + req.json()['message'])
return req.json()