This commit is contained in:
parent
3efaa34b94
commit
a93e3a273d
@ -30,7 +30,9 @@ class ListsApi(UserStoreResource):
|
|||||||
collections = musicbrainzngs.get_collections()
|
collections = musicbrainzngs.get_collections()
|
||||||
musicbrainzngs.auth(None, None)
|
musicbrainzngs.auth(None, None)
|
||||||
elementlist = []
|
elementlist = []
|
||||||
|
collcount = 0
|
||||||
for collection in collections['collection-list']:
|
for collection in collections['collection-list']:
|
||||||
|
collcount += 1
|
||||||
if collection['entity-type'] == 'release':
|
if collection['entity-type'] == 'release':
|
||||||
count = collection['release-count']
|
count = collection['release-count']
|
||||||
elif collection['entity-type'] == 'artist':
|
elif collection['entity-type'] == 'artist':
|
||||||
@ -40,11 +42,12 @@ class ListsApi(UserStoreResource):
|
|||||||
elif collection['entity-type'] == 'recording':
|
elif collection['entity-type'] == 'recording':
|
||||||
count = collection['recording-count']
|
count = collection['recording-count']
|
||||||
else:
|
else:
|
||||||
|
collcount -= 1
|
||||||
continue
|
continue
|
||||||
flaskred.set(collection['id'], collection['entity-type'].encode('UTF-8'))
|
flaskred.set(collection['id'], collection['entity-type'].encode('UTF-8'))
|
||||||
elementlist.append({"id": collection['id'], "name": collection['name'], "element_count": count,
|
elementlist.append({"id": collection['id'], "name": collection['name'], "element_count": count,
|
||||||
"type": collection['entity-type']})
|
"type": collection['entity-type']})
|
||||||
returndict = {"count": collections['collection-count'],
|
returndict = {"count": collcount,
|
||||||
"ids": elementlist}
|
"ids": elementlist}
|
||||||
|
|
||||||
return returndict, 200
|
return returndict, 200
|
||||||
|
@ -22,6 +22,6 @@ class MeApi(Resource):
|
|||||||
try:
|
try:
|
||||||
currusername = flaskred.get(request.headers.get('Authorization')).decode('UTF-8')
|
currusername = flaskred.get(request.headers.get('Authorization')).decode('UTF-8')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
current_app.logger.warning(e)
|
current_app.logger.info(e)
|
||||||
abort(401, "unauthorized")
|
abort(401, "unauthorized")
|
||||||
return {"name": currusername}, 200
|
return {"name": currusername}, 200
|
||||||
|
@ -87,7 +87,7 @@ class SingleListApi(SpotifyUserStoreResource):
|
|||||||
workdata['cover_url'] = work_image[0]['url']
|
workdata['cover_url'] = work_image[0]['url']
|
||||||
workdata['cover_url_small'] = work_image[len(work_image) - 1]['url']
|
workdata['cover_url_small'] = work_image[len(work_image) - 1]['url']
|
||||||
worklist.append(workdata)
|
worklist.append(workdata)
|
||||||
flaskred.set(work['id'], 'recording'.encode('UTF-8'))
|
flaskred.set(work['id'], 'work'.encode('UTF-8'))
|
||||||
retdata = {"id": currdata['id'], "element_count": currdata['work-count'], "itemlist": worklist}
|
retdata = {"id": currdata['id'], "element_count": currdata['work-count'], "itemlist": worklist}
|
||||||
elif list_type == 'recording':
|
elif list_type == 'recording':
|
||||||
currdata = musicbrainzngs.get_recordings_in_collection(listid, limit, offset)['collection']
|
currdata = musicbrainzngs.get_recordings_in_collection(listid, limit, offset)['collection']
|
||||||
|
Loading…
Reference in New Issue
Block a user