ListenBrainz: Fixed loves pagination

This commit is contained in:
Philipp Wolfer 2023-11-13 09:47:27 +01:00
parent 719ef5b84b
commit ebcec46d7a
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
2 changed files with 5 additions and 6 deletions

View file

@ -80,6 +80,7 @@ func (c Client) GetFeedback(user string, status int, offset int) (result GetFeed
"status": strconv.Itoa(status), "status": strconv.Itoa(status),
"offset": strconv.Itoa(offset), "offset": strconv.Itoa(offset),
"count": strconv.Itoa(c.MaxResults), "count": strconv.Itoa(c.MaxResults),
"metadata": "true",
}). }).
SetResult(&result). SetResult(&result).
Get(path) Get(path)

View file

@ -78,8 +78,6 @@ out:
func (b ListenBrainzApiBackend) ExportLoves(oldestTimestamp time.Time) ([]models.Love, error) { func (b ListenBrainzApiBackend) ExportLoves(oldestTimestamp time.Time) ([]models.Love, error) {
offset := 0 offset := 0
// perPage := MaxItemsPerGet
loves := make([]models.Love, 0, 2*MaxItemsPerGet) loves := make([]models.Love, 0, 2*MaxItemsPerGet)
out: out:
@ -103,7 +101,7 @@ out:
} }
} }
offset += 1 offset += MaxItemsPerGet
} }
slices.Reverse(loves) slices.Reverse(loves)