alepon
August 3, 2023, 11:30am
1
i use rust api wrapper for musicbrainz GitHub - oknozor/musicbrainz_rs: A wrapper around the musicbrainz API and not all artist recordings browses by Recording::browse
how can i fix it?
For browse requests there is a pagination. By default a browse request returns 25 results. This can be increased with the limit
parameter to a maximum of 100. To return additional results another request can be made with the offset
parameter. See the documentation at
https://musicbrainz.org/doc/MusicBrainz_API#Browse
I can’t tell you how to do the pagination with the rust library, though. You should consult the documentation of that library.
3 Likes
Actually it looks like that library does not support pagination:
opened 07:00PM - 09 Jan 23 UTC
closed 01:38AM - 10 Jan 23 UTC
I'm attempting to use this library to page through the browse API, but I don't s… ee anything which supports this built in. Am I missing something?
https://beta.musicbrainz.org/doc/MusicBrainz_API#Browse
> **Paging**
Browse requests are the only requests which support paging: any browse request supports an 'offset=' argument to get more results. Browse requests also support 'limit=': the default limit is 25, and you can increase that up to 100.
> **Special note for releases:** To ensure requests can complete without timing out, we limit the number of releases returned such that the entire list contains no more than 500 tracks. (However, at least one full release is always returned, even if it has more than 500 tracks; we don't return "partial" releases.) This means that you may not get 100 releases per page if you set limit=100; in fact the number will vary per page depending on the size of the releases. In order to page through the results properly, increment offset by the number of releases you get from each response, rather than the (larger, fixed) limit size.
Maybe you can provide a patch to add that functionality?
2 Likes
Maybe the existing PR is already sufficient? Or it is only for search requests:
oknozor:main
← nappa85:pagination
opened 08:45PM - 24 Jan 23 UTC
My bad for this second PR, but I also think it's better to separate concepts.
T… his PR is kind-of more invasive than the previous, it introduces pagination on search queries and, to not insert a `score` field in every entity, introduces a `SearchEntity` wrapper that leverages serde's flatten to be transparent on deserialization.
What I don't really like here is having `inner` field as public, since its fields are already accessible via Deref and DerefMut.
What do you think about it? Maybe an `impl<T> Into<T> for SearchEntity<T>` would be better?
(I’m neither using the library nor do I speak rust)
1 Like