From 38808dba6772a91a21709ea0dc4a1071a417e873 Mon Sep 17 00:00:00 2001 From: iou1name Date: Wed, 15 May 2019 13:08:28 -0400 Subject: [PATCH] albums sort by date instead of alphabetically --- musik.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/musik.py b/musik.py index 58039ff..d8464f4 100755 --- a/musik.py +++ b/musik.py @@ -187,8 +187,9 @@ class Selection(Resource): found.append(track) if not found: abort(404, message="Artist does not exist.") - found = list(set(t.album for t in found)) - return sorted(found) + seen = {track.album: track.date for track in found} + found = sorted(seen.keys(), key=lambda album: seen[album]) + return found class RandomSelection(Resource):