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