jf-roku/components/liveTv/LoadSheduleTask.brs

41 lines
810 B
Plaintext
Raw Normal View History

2020-11-23 17:13:57 +00:00
sub init()
m.top.functionName = "loadSchedule"
2021-07-09 20:08:32 +00:00
end sub
sub loadSchedule()
2020-11-23 17:13:57 +00:00
results = []
2021-07-09 20:08:32 +00:00
2020-11-23 17:13:57 +00:00
params = {
2021-07-09 20:08:32 +00:00
UserId: get_setting("active_user"),
SortBy: "startDate",
EnableImages: false
EnableTotalRecordCount: false,
EnableUserData: false
channelIds: m.top.channelIds
MaxStartDate: m.top.endTime,
MinEndDate: m.top.startTime
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/Programs"
resp = APIRequest(url)
2021-07-09 20:08:32 +00:00
data = postJson(resp, FormatJson(params))
if data = invalid
2020-11-23 17:13:57 +00:00
m.top.schedule = results
return
end if
results = []
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
program = createObject("roSGNode", "ScheduleProgramData")
program.json = item
results.push(program)
2020-11-23 17:13:57 +00:00
end for
2021-07-09 20:08:32 +00:00
2020-11-23 17:13:57 +00:00
m.top.schedule = results
2021-07-09 20:08:32 +00:00
end sub