rokudev / SceneGraphDeveloperExtensions

Other
113 stars 65 forks source link

Facing Roku Device Crashed Issue with TimeGridView Component. #97

Open chaklasiyanikunj opened 1 year ago

chaklasiyanikunj commented 1 year ago

Hello,

I used your TimeGridView Component.

ChRoot File

sub GetContent()
    ' Fetch URL From Browser

    rxfer = CreateObject("roUrlTransfer")

    m.channels = "http:/203.109.69.134:8687/api/DefaultAPI/?file=1_channelsname.json" ' Here File Call From Server

    rxfer.SetUrl(m.channels)
    raw = rxfer.GetToString()
    json = ParseJson(raw)

    rootChildren = {
        children: []
    } ' channels array

    for each channel in json

        ch = "http://203.109.69.134:8687/api/DefaultAPI/?file=" + channel + ".json" ' Here File Call From Server

        rxfer.SetUrl(ch)

        raw = rxfer.GetToString()

        channelJSON = ParseJson(raw)

        channelNode = CreateObject("roSGNode", "ContentNode")
        channelNode.title = channelJSON.channel.call_sign
        channelNode.hdposterurl = channelJSON.channel.call_sign_img  ' .EncodeUriComponent()
        channelNode.id = channelJSON.object_id

        channelNode.id = channelJSON.object_id.ToStr()

        channelNode.AddFields({
            HandlerConfigTimeGrid: {
                name: "CHRow"
            }
        })

        rootChildren.children.Push(channelNode)
    end for

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

ChRow File

sub GetContent()

    id = m.top.content.id
    dt = CreateObject("roDateTime")
    now = dt.AsSeconds()

    static = "00:00:00"
    st = static.Split(":")

    dt.ToLocalTime()

    currenthour = dt.GetHours()

    diff = currenthour - st[0].ToInt()
    remain = diff * 60 * 60

    if (dt.GetMinutes() > 30)
        playStart = now - (now mod 1800) - (86400 + remain + ((dt.GetTimeZoneOffset() * 60) + 30 * 60))
    else
        playStart = now - (now mod 1800) - (86400 + remain + (dt.GetTimeZoneOffset() * 60))
    end if

    rxfer = CreateObject("roUrlTransfer")

    channels = "http://203.109.69.134:8687/api/DefaultAPI/?file=3_guide_" + id + ".json" ' Here File Call From Server

    rxfer.SetUrl(channels)

    raw = rxfer.GetToString()

    json = ParseJson(raw)

    programNodes = {
        children: []
    }

    for each program in json
        ' create a node for the program and set its me

        programNode = {}
        if program.title <> invalid and program.title <> ""
            programNode.title = program.title
            programNode.url = program.url
            programNode.text = program.text
            programNode.description = + program.description
            programNode.FHDPosterUrl = + program.HDPosterUrl
            programNode.HDPosterUrl = + program.FHDPosterUrl
            programNode.TitleSeason = + program.channel_description

            programNode.id = program.season_number

            programNode.ShortDescriptionLine1 = program.clipstart
            programNode.ShortDescriptionLine2 = program.clipend

            programNode.ReleaseDate = program.airing_details.datetime
        else if program.airing_details.show_title <> invalid and program.airing_details.show_title <> ""
            programNode.title = program.airing_details.show_title
        else
            programNode.title = "---"
        end if
        if program.season_number <> invalid and program.episode_number <> invalid
            programNode.description = "S" + program.season_number.ToStr() + " E" + program.episode_number.ToStr()
        end if

        programNode.playStart = playStart
        programNode.playDuration = program.airing_details.duration
        programNodes.children.Push(programNode)

        playstart += programNode.playDuration
    end for

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

Thank you, With regards, Nikunj

RokuChris commented 1 year ago

Device reboots can be an indication of memory problems, especially on less capable devices. As a first step, I would suggest using Roku Resource Monitor or the Brightscript Profiler to better understand what's going on. https://devtools.web.roku.com/