mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-18 19:19:28 +02:00
ListenBrainz: Fixed loves pagination
This commit is contained in:
parent
719ef5b84b
commit
ebcec46d7a
2 changed files with 5 additions and 6 deletions
|
@ -77,9 +77,10 @@ func (c Client) GetFeedback(user string, status int, offset int) (result GetFeed
|
||||||
response, err := c.HttpClient.R().
|
response, err := c.HttpClient.R().
|
||||||
SetPathParam("username", user).
|
SetPathParam("username", user).
|
||||||
SetQueryParams(map[string]string{
|
SetQueryParams(map[string]string{
|
||||||
"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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue