Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
codeTransonic
Level 7

TimeGrid with ContentHandler having Multiple Tasks Per Row (Non Serial) or (Serial)

I am trying to implement LazyLoaded Paged out Programs fetching for each Channel Row, I would really appreciate if someone from Roku Team can point me in the right direction, as it doesn't call the Row Channel Programs Fetching ContentHandler more than once.

My code for Fetching the Row Content for each Row set in GetContent of TimeGrid Root ContentHandler is as follows

sub GetContent()

    response =readInternet.getToString()
    json = ParseJSON(response)

    rootChildren = {
        children: [],
    } ' channels array

    for each channel in json.arrayChannels
        ' create a node for the channel and set its metadata fields

        channelNode = CreateObject("roSGNode", "ContentNode")
        channelNode.title = channel.title
        channelNode.start_date = channel.start_date
        channelNode.end_date = channel.end_date
        channelNode.thumbnail = channel.thumbnail
        channelNode.HDSMALLICONURL = channel.thumbnail

        channelNode.AddFields({
           HandlerConfigTimeGrid: {
               name: "ChannelProgramsFetcher",
               fields: {
                day: 0,
                pageSize: 300,
                hasMore: true
               }
           },
        })
        rootChildren.children.Push(channelNode)
    end for
    m.top.content.Update(rootChildren)
    
end sub

Below is the code for GetContent() which is defined in the ContentHandler - ChannelProgramsFetcher

sub GetContent()

    response =readInternet.getToString()
    json = ParseJSON(response)

    programNodes = {
        children: [],
        HandlerConfigTimeGrid: {
            name: "ChannelProgramsFetcher",
            fields: {
             day: m.top.day + 1,
             pageSize: 300,
             hasMore: true
            }
        }
    }

    for each program in json
        ' create a node for the program and set its metadata fields
        programNode = {}

        programNode.title = program.title
        programNode.description = program.description

        currentTime.FromISO8601String(program.start_date)
        programNode.playStart = currentTime.AsSeconds()
        programNode.playDuration = program.duration

        programNodes.children.Push(programNode)

    end for

    m.top.content.Update(programNodes)
end sub

Even with the hasMore and pageSize fields added, the ContentHandler for fetching Programs for Row only gets called once, looking forward to hearing back from you,

Thanking you in advance, have a blessed day!

 

 

0 Kudos
1 REPLY 1\
codeTransonic
Level 7

Re: TimeGrid with ContentHandler having Multiple Tasks Per Row (Non Serial) or (Serial)

Unlike fields that are supposed to be passed as above the hasMore: true needs to be set as below instead in the fields

HandlerConfigTimeGrid: {
            name: "ChannelProgramsFetcher",
            hasMore: true,
            pageSize: 30,
            fields: {
             day: m.top.day + 1,
            }
        }

Leaving the answer here which might help someone, seeking the same!

0 Kudos