# Q about Framework

**URL:** <https://forums.plex.tv/t/q-about-framework/46197>\
**Category:** Dev/API Corner\
**Tags:** other-dev\
**Created:** [November 5, 2013, 7:21pm UTC](https://forums.plex.tv/t/q-about-framework/46197 "2013-11-05T19:21:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [November 5, 2013, 7:21pm UTC](https://forums.plex.tv/t/q-about-framework/46197/1 "2013-11-05T19:21:34Z")

</div>

When trying to avoid a timeout when building a directory structure, I stumbled across this plug-in:

&nbsp;

[Vimeo](https://github.com/plexinc-plugins/Vimeo.bundle/blob/master/Contents/Code/ __init__.py)

&nbsp;

&nbsp;

First of all, would still love some docs about the following:

```
@parallelize
```

```
@task
```

But my main Q is about what the following do:

```
NextPageObject ??????
```

Complete codeline says:

```
oc.add(NextPageObject(
			key = Callback(GetDirectory, title=title, url=url, page=page+1),
			title = L('More...')
```

Huge thanks in advance

&nbsp;

/Tommy

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [November 7, 2013, 10:21pm UTC](https://forums.plex.tv/t/q-about-framework/46197/2 "2013-11-07T22:21:32Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [November 8, 2013, 12:06am UTC](https://forums.plex.tv/t/q-about-framework/46197/3 "2013-11-08T00:06:01Z")

</div>

> 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:

---

<div class="post-metadata">

**Author:** ![mikedm139](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/mikedm139/32/96909_2.png) [@mikedm139](https://forums.plex.tv/u/mikedm139)\
**Post date:** [November 8, 2013, 3:51am UTC](https://forums.plex.tv/t/q-about-framework/46197/4 "2013-11-08T03:51:38Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![dane22](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dane22/32/4389_2.png) [@dane22](https://forums.plex.tv/u/dane22)\
**Post date:** [November 8, 2013, 11:47pm UTC](https://forums.plex.tv/t/q-about-framework/46197/5 "2013-11-08T23:47:04Z")

</div>

> 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.....

You're Da' man

/Tommy

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 12:24am UTC](https://forums.plex.tv/t/q-about-framework/46197/6 "2019-12-21T00:24:08Z")

</div>

Closed on December 21, 2019, 12:24am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
