From c1d7c73649333af639a7447c72056777e34ea20f Mon Sep 17 00:00:00 2001 From: cwilvx Date: Mon, 14 Oct 2024 13:54:06 +0300 Subject: [PATCH] handle -1 limit on get artist --- app/api/artist.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/artist.py b/app/api/artist.py index 1a9c76d7..e8ae5c91 100644 --- a/app/api/artist.py +++ b/app/api/artist.py @@ -81,6 +81,8 @@ def get_artist(path: ArtistHashSchema, query: GetArtistQuery): artist.genres.insert(0, {"name": decade, "genrehash": decade}) duration = sum(t.duration for t in tracks) if tracks else 0 + tracks = tracks[:limit] if (limit and limit != -1) else tracks + tracks = [ { **serialize_track(t), @@ -90,7 +92,7 @@ def get_artist(path: ArtistHashSchema, query: GetArtistQuery): else f"{t.playcount} play{'' if t.playcount == 1 else 's'}" ), } - for t in tracks[:limit] + for t in tracks ] query.limit = query.albumlimit