2023-10-03 16:11:25 +00:00
|
|
|
import "pkg:/source/api/baserequest.bs"
|
|
|
|
import "pkg:/source/utils/config.bs"
|
2023-05-03 21:21:04 +00:00
|
|
|
|
2020-11-23 17:13:57 +00:00
|
|
|
sub init()
|
|
|
|
m.top.functionName = "loadProgramDetails"
|
2021-07-09 20:08:32 +00:00
|
|
|
|
2020-11-23 17:13:57 +00:00
|
|
|
end sub
|
|
|
|
|
|
|
|
sub loadProgramDetails()
|
|
|
|
|
|
|
|
channelIndex = m.top.ChannelIndex
|
|
|
|
programIndex = m.top.ProgramIndex
|
|
|
|
|
|
|
|
params = {
|
2023-06-01 12:43:27 +00:00
|
|
|
UserId: m.global.session.user.id
|
2020-11-23 17:13:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
url = Substitute("LiveTv/Programs/{0}", m.top.programId)
|
|
|
|
|
|
|
|
resp = APIRequest(url, params)
|
|
|
|
data = getJson(resp)
|
|
|
|
|
2021-06-26 13:52:16 +00:00
|
|
|
if data = invalid
|
2020-11-23 17:13:57 +00:00
|
|
|
m.top.programDetails = {}
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
|
|
|
|
program = createObject("roSGNode", "ScheduleProgramData")
|
|
|
|
program.json = data
|
2021-06-26 10:04:32 +00:00
|
|
|
program.channelIndex = channelIndex
|
|
|
|
program.programIndex = programIndex
|
2020-11-23 17:13:57 +00:00
|
|
|
program.fullyLoaded = true
|
2022-01-09 04:40:25 +00:00
|
|
|
' Are we currently recording this program?
|
2022-01-09 14:56:52 +00:00
|
|
|
if program.json.TimerId <> invalid and program.json.TimerId <> ""
|
2022-01-09 04:40:25 +00:00
|
|
|
' This is needed here because the callee (onProgramDetailsLoaded) replaces the grid item with
|
|
|
|
' this newly created item from the server, without this, the red icon
|
2022-01-09 05:50:53 +00:00
|
|
|
' disappears when the user focuses on the program in question
|
2022-01-09 04:40:25 +00:00
|
|
|
program.hdSmallIconUrl = "pkg:/images/red.png"
|
2022-01-09 14:56:10 +00:00
|
|
|
else
|
|
|
|
program.hdSmallIconUrl = invalid
|
2022-01-09 04:40:25 +00:00
|
|
|
end if
|
2020-11-23 17:13:57 +00:00
|
|
|
m.top.programDetails = program
|
|
|
|
|
2022-05-30 12:57:40 +00:00
|
|
|
end sub
|