Re: Question about paginated browsing



On Thu, 2014-01-30 at 09:17 -0500, W. Michael Petullo wrote:
My question is this: how do I know if I should present the more option?
The count functions all return GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN
when working with Jamendo, and so the remaining option that is passed
to my browse_cb is not useful until it is 0 (from what I can tell). 0
indicates that only the current "page" is complete, not whether or not
there is more information available.


IMHO the "more option" should be shown/activated after the current
request has been satisfied totally; that is, after you receive a
browse_cb with remaining to 0: it means that all elements requested has
been sent, and no more can be sent.

How to know if really there are more elements to request? There's two
solutions:

- If you ask for the next chunk, and you get remaining 0, it means that
there are no more elements at all.

- A better solution is to count how many elements are you getting. For
instance, if you ask 30 elements and you only get 10, it's clear that in
the server it remains only 10 elements (if there were more, it would try
to satisfy your full request). So in this case you can hide the "more
elements" option.

To implement the later, I'm afraid you need to count how many elements
you are getting in the browse_cb. You can't rely in the remaining
option, because that is what the source guesses it remains to be sent.
In some cases, the source can't know, because the server doesn't tell
it. In other cases it could even jump from one value to another. It's
main purpose is in case you want to implement something similar to a
progress.

Of course, if browse_cb's remaining goes to 0 before I receive "set_count"
items, then I know I am done. However, if it goes to zero after receiving
"set_count" items, then I don't know where I stand.

What am I missing?


Hope above can help you.

        J.A.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]