WIP (can start single recording from guide)

This commit is contained in:
jimiatnymbl 2022-01-08 17:04:38 -07:00
parent 8af0148e59
commit c9bf023949
3 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,33 @@
sub init()
m.top.functionName = "RecordProgram"
end sub
sub RecordProgram()
' Get Live TV default params from server...
if m.top.programDetails <> invalid
programId = m.top.programDetails.Id
url = "LiveTv/Timers/Defaults"
params = {
programId: programId
}
resp = APIRequest(url, params)
data = getJson(resp)
if data <> invalid
' Create recording timer...
url = "LiveTv/Timers"
resp = APIRequest(url)
success = postJson(resp, FormatJson(data))
print "success value " success
' Indicate success back to our caller
m.top.timerCreated = true
else
' Error msg to user?
print "Error getting Live TV Defaults from Server"
m.top.timerCreated = false
end if
end if
end sub

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="RecordProgramTask" extends="Task">
<interface>
<field id="programDetails" type="node" value="" />
<field id="timerCreated" type="boolean" value="" />
</interface>
<script type="text/brightscript" uri="RecordProgramTask.brs" />
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
</component>

View File

@ -190,9 +190,22 @@ sub onRecordChannelSelected()
'TODO/FIXME:
' * Present "Please Wait"
' * Send data to Server
m.RecordProgramTask = createObject("roSGNode", "RecordProgramTask")
m.RecordProgramTask.programDetails = m.detailsPane.programDetails
m.RecordProgramTask.observeField("timerCreated", "onTimerCreated")
m.RecordProgramTask.control = "RUN"
' * Indicate success / failure
print "***Recording not implemented yet***"
end sub
sub onTimerCreated()
if m.RecordProgramTask.timerCreated = true
print "Timer Created Successfully!!"
else
print "Timer creation failed :-("
end if
end sub
' As user scrolls grid, check if more data requries to be loaded