jf-roku/components/liveTv/LoadChannelsTask.brs

35 lines
619 B
Plaintext
Raw Normal View History

2020-11-23 17:13:57 +00:00
sub init()
m.top.functionName = "loadChannels"
2021-07-09 20:08:32 +00:00
end sub
sub loadChannels()
2020-11-23 17:13:57 +00:00
results = []
2021-07-09 20:08:32 +00:00
params = {
UserId: get_setting("active_user")
'limit: m.top.limit,
'StartIndex: m.top.startIndex
2020-11-23 17:13:57 +00:00
}
2021-07-09 20:08:32 +00:00
2020-11-23 17:13:57 +00:00
url = "LiveTv/Channels"
resp = APIRequest(url, params)
data = getJson(resp)
2021-07-09 20:08:32 +00:00
if data.TotalRecordCount = invalid
2020-11-23 17:13:57 +00:00
m.top.channels = results
return
end if
2021-07-09 20:08:32 +00:00
2020-11-23 17:13:57 +00:00
for each item in data.Items
2021-07-09 20:08:32 +00:00
channel = createObject("roSGNode", "ChannelData")
channel.json = item
results.push(channel)
end for
2020-11-23 17:13:57 +00:00
m.top.channels = results
2021-07-09 20:08:32 +00:00
end sub