NextPageObject() is a (as yet undocumented) function to standardize paging in channels. For clients that support (such as iOS), it translates to "infitinite scrolling". It helps to speed things up where loading large lists can often cause time-outs, by breaking the list into smaller, more manageable pages.
NextPageObject() is a (as yet undocumented) function to standardize paging in channels. For clients that support (such as iOS), it translates to "infitinite scrolling". It helps to speed things up where loading large lists can often cause time-outs, by breaking the list into smaller, more manageable pages.
And that's exactly what I need, so who to nag for info? :wub:
Basically, the function takes one primary argument which is the name of the function which generates the ObjectContainer. Secondary keyword arguments are determined by what parameters are expected by the primary function argument. Often a NextPageObject() ends up creating a nested functional it is used to call the very same function in which it is contained. In some cases, the paging is dictated by the source of the data but in others you will need to decide how to break it up. Here’s a basic example:
@route('/video/example/videolist', offset=int)
#we cast the offset variable as an int, otherwise it gets interpreted as a string and makes life difficult.
def VideoList(offset=0):
#default offset value is 0 when called from previous menu level but, we'll increment it as we go
oc = ObjectContainer()
videos = some_list
#let's use a page size of 20 items
new_offset = offset+20
for video in videos[offset:new_offset]:
#add each video to the object container
oc.add(...)
#once we've added a full "page" worth of videos, let's check to see if there are more left in the list
if len(videos) > new_offset:
#if so, let's add a page
oc.add(NextPageObject(VideoList, offset=new_offset)) #title and thumb are set by default so we don't need to add them unless you want something other than the default values.
return oc
Basically, the function takes one primary argument which is the name of the function which generates the ObjectContainer. Secondary keyword arguments are determined by what parameters are expected by the primary function argument. Often a NextPageObject() ends up creating a nested functional it is used to call the very same function in which it is contained. In some cases, the paging is dictated by the source of the data but in others you will need to decide how to break it up. Here's a basic example:
@route('/video/example/videolist', offset=int)
#we cast the offset variable as an int, otherwise it gets interpreted as a string and makes life difficult.
def VideoList(offset=0):
#default offset value is 0 when called from previous menu level but, we'll increment it as we go
oc = ObjectContainer()
videos = some_list
#let's use a page size of 20 items
new_offset = offset+20
for video in videos[offset:new_offset]:
#add each video to the object container
oc.add(...)
#once we've added a full "page" worth of videos, let's check to see if there are more left in the list
if len(videos) > new_offset:
#if so, let's add a page
oc.add(NextPageObject(VideoList, offset=new_offset)) #title and thumb are set by default so we don't need to add them unless you want something other than the default values.
return oc
Once more, the "real" Mike, @ least in my book, comes to the rescue.
ThanX Mike, now all that remains is for me to digest this, and turn it into something that works with my code.....