fixed networking and added handling for currently playing
This commit is contained in:
parent
f4415ec867
commit
7d23f6302d
@ -13,8 +13,8 @@ def exportScrobbles(scrobbles, path):
|
||||
writer.writeheader()
|
||||
|
||||
for track in scrobbles:
|
||||
|
||||
trackdict = {
|
||||
if '@attr' not in track:
|
||||
trackdict = {
|
||||
'track':track['name'].replace(';', '_').replace(',', '_'),
|
||||
'album':track['album']['#text'].replace(';', '_').replace(',', '_'),
|
||||
'artist':track['artist']['#text'].replace(';', '_').replace(',', '_'),
|
||||
@ -23,4 +23,4 @@ def exportScrobbles(scrobbles, path):
|
||||
'album id':track['album']['mbid'],
|
||||
'artist id':track['artist']['mbid']}
|
||||
|
||||
writer.writerow(trackdict)
|
||||
writer.writerow(trackdict)
|
||||
|
@ -21,11 +21,15 @@ 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:
|
||||
|
||||
raise ValueError('HTTP Error Raised: ' + str(req.json()['error']) + ' ' + req.json()['message'])
|
||||
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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user