mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-06 04:59:55 +02:00
Resolve "Pagination of results in genres in Subsonic API does not work"
This commit is contained in:
parent
ae0f7588e4
commit
69795b5ca2
3 changed files with 25 additions and 1 deletions
|
@ -351,6 +351,12 @@ class SubsonicViewSet(viewsets.GenericViewSet):
|
|||
)
|
||||
)
|
||||
queryset = queryset.playable_by(actor)
|
||||
try:
|
||||
offset = int(data.get("offset", 0))
|
||||
except (TypeError, ValueError):
|
||||
|
||||
offset = 0
|
||||
|
||||
try:
|
||||
size = int(
|
||||
data["count"]
|
||||
|
@ -369,7 +375,7 @@ class SubsonicViewSet(viewsets.GenericViewSet):
|
|||
)
|
||||
.prefetch_related("uploads")
|
||||
.distinct()
|
||||
.order_by("-creation_date")[:size]
|
||||
.order_by("-creation_date")[offset : offset + size]
|
||||
)
|
||||
data = {
|
||||
"songsByGenre": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue