oopsie
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Torma Kristóf 2020-11-26 21:33:44 +01:00
parent 3efaa34b94
commit a93e3a273d
3 changed files with 6 additions and 3 deletions

View File

@ -30,7 +30,9 @@ class ListsApi(UserStoreResource):
collections = musicbrainzngs.get_collections()
musicbrainzngs.auth(None, None)
elementlist = []
collcount = 0
for collection in collections['collection-list']:
collcount += 1
if collection['entity-type'] == 'release':
count = collection['release-count']
elif collection['entity-type'] == 'artist':
@ -40,11 +42,12 @@ class ListsApi(UserStoreResource):
elif collection['entity-type'] == 'recording':
count = collection['recording-count']
else:
collcount -= 1
continue
flaskred.set(collection['id'], collection['entity-type'].encode('UTF-8'))
elementlist.append({"id": collection['id'], "name": collection['name'], "element_count": count,
"type": collection['entity-type']})
returndict = {"count": collections['collection-count'],
returndict = {"count": collcount,
"ids": elementlist}
return returndict, 200

View File

@ -22,6 +22,6 @@ class MeApi(Resource):
try:
currusername = flaskred.get(request.headers.get('Authorization')).decode('UTF-8')
except Exception as e:
current_app.logger.warning(e)
current_app.logger.info(e)
abort(401, "unauthorized")
return {"name": currusername}, 200

View File

@ -87,7 +87,7 @@ class SingleListApi(SpotifyUserStoreResource):
workdata['cover_url'] = work_image[0]['url']
workdata['cover_url_small'] = work_image[len(work_image) - 1]['url']
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}
elif list_type == 'recording':
currdata = musicbrainzngs.get_recordings_in_collection(listid, limit, offset)['collection']