55 lines
1.8 KiB
Plaintext
55 lines
1.8 KiB
Plaintext
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
|
' Copyright (C) 2022 Brahim Hadriche
|
|
|
|
' This program is free software: you can redistribute it and/or modify
|
|
' it under the terms of the GNU Affero General Public License as published by
|
|
' the Free Software Foundation, either version 3 of the License, or
|
|
' (at your option) any later version.
|
|
|
|
' This program is distributed in the hope that it will be useful,
|
|
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
' GNU Affero General Public License for more details.
|
|
|
|
' You should have received a copy of the GNU Affero General Public License
|
|
' along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
function main(args as object) as void
|
|
screen = CreateObject("roSGScreen")
|
|
m.port = CreateObject("roMessagePort")
|
|
screen.setMessagePort(m.port)
|
|
m.global = screen.getGlobalNode()
|
|
|
|
scene = screen.CreateScene("MainScene")
|
|
screen.show()
|
|
scene.ObserveField("exitChannel", m.port)
|
|
scene.launchArgs = args
|
|
|
|
input = CreateObject("roInput")
|
|
input.setMessagePort(m.port)
|
|
|
|
' The following comment is to enable the SceneGraph inspector
|
|
' on the VSCode BrightScript plugin.
|
|
#if DEBUG
|
|
' vscode_rdb_on_device_component_entry
|
|
#end if
|
|
|
|
while true
|
|
msg = wait(0, m.port)
|
|
msgType = type(msg)
|
|
if msgType = "roSGScreenEvent"
|
|
if msg.isScreenClosed()
|
|
return
|
|
end if
|
|
else if msgType = "roSGNodeEvent"
|
|
field = msg.getField()
|
|
data = msg.getData()
|
|
if field = "exitChannel" and data = true
|
|
END
|
|
end if
|
|
else if msgType = "roInputEvent"
|
|
scene.inputArgs = msg.getInfo()
|
|
end if
|
|
end while
|
|
end function
|