Overlay a three-row scrolling guide on live playback
This commit is contained in:
@@ -23,7 +23,7 @@ IP or hostname. Use `IP:port` if the bridge uses a port other than `4242`.
|
|||||||
- **Star** opens the guide. Press it from the guide for channel refresh and server selection.
|
- **Star** opens the guide. Press it from the guide for channel refresh and server selection.
|
||||||
- **Back** closes the guide or menu, then exits from the tuner.
|
- **Back** closes the guide or menu, then exits from the tuner.
|
||||||
|
|
||||||
The app opens on the guide. The details pane shows current and upcoming titles for the highlighted channel. Channel 99 displays local weather. Playback starts from the live HLS playlist supplied by the bridge.
|
The app opens on the guide. The guide scrolls three channels at a time in an overlay along the bottom of the picture, with current and upcoming programming for each row. Channel 99 displays local weather. Playback starts from the live HLS playlist supplied by the bridge.
|
||||||
SSDP discovery, playback, and live timing require validation on Roku hardware.
|
SSDP discovery, playback, and live timing require validation on Roku hardware.
|
||||||
|
|
||||||
## Desktop simulator
|
## Desktop simulator
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
sub showPanel(mode as string, title as string, status as string, titles as object)
|
sub showPanel(mode as string, title as string, status as string, titles as object)
|
||||||
m.panelMode = mode
|
m.panelMode = mode
|
||||||
m.guideDetails.visible = false
|
m.guideOverlay.visible = false
|
||||||
m.menu.itemSize = [1150, 50]
|
|
||||||
m.panelTitle.text = title
|
m.panelTitle.text = title
|
||||||
m.panelStatus.text = status
|
m.panelStatus.text = status
|
||||||
content = CreateObject("roSGNode", "ContentNode")
|
content = CreateObject("roSGNode", "ContentNode")
|
||||||
@@ -22,6 +21,7 @@ end sub
|
|||||||
sub closePanel()
|
sub closePanel()
|
||||||
m.panelMode = ""
|
m.panelMode = ""
|
||||||
m.panel.visible = false
|
m.panel.visible = false
|
||||||
|
m.guideOverlay.visible = false
|
||||||
m.remoteFocus.SetFocus(true)
|
m.remoteFocus.SetFocus(true)
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
@@ -56,18 +56,6 @@ sub onMenuSelect(event as object)
|
|||||||
else
|
else
|
||||||
findServer("", false)
|
findServer("", false)
|
||||||
end if
|
end if
|
||||||
else if m.panelMode = "guide"
|
|
||||||
if index < 0 or index >= m.guideIds.Count() then return
|
|
||||||
id = m.guideIds[index]
|
|
||||||
for i = 0 to m.channels.Count() - 1
|
|
||||||
if m.channels[i].id = id
|
|
||||||
closePanel()
|
|
||||||
if i <> m.channelIndex then tune(i)
|
|
||||||
exit for
|
|
||||||
end if
|
|
||||||
end for
|
|
||||||
else if m.panelMode = "guideError"
|
|
||||||
openGuide()
|
|
||||||
end if
|
end if
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
@@ -77,7 +65,13 @@ sub openGuide(offset = 0 as integer)
|
|||||||
m.guideRequest.control = "stop"
|
m.guideRequest.control = "stop"
|
||||||
end if
|
end if
|
||||||
m.guideOffset = offset
|
m.guideOffset = offset
|
||||||
showPanel("guideLoading", "Program guide", "Loading the schedule…", [])
|
m.panelMode = "guideLoading"
|
||||||
|
m.panel.visible = false
|
||||||
|
m.banner.visible = false
|
||||||
|
m.guideOverlay.visible = true
|
||||||
|
m.guideRows.visible = false
|
||||||
|
m.guideStatus.text = "Loading the schedule…"
|
||||||
|
m.remoteFocus.SetFocus(true)
|
||||||
m.guideRequest = startRequest({url: m.server.baseUrl + "/api/v1/guide?hours=3"}, "onGuide")
|
m.guideRequest = startRequest({url: m.server.baseUrl + "/api/v1/guide?hours=3"}, "onGuide")
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
@@ -87,57 +81,81 @@ sub onGuide(event as object)
|
|||||||
if m.panelMode <> "guideLoading" then return
|
if m.panelMode <> "guideLoading" then return
|
||||||
data = event.GetData().data
|
data = event.GetData().data
|
||||||
if data = invalid or GetInterface(data.channels, "ifArray") = invalid or data.channels.Count() = 0
|
if data = invalid or GetInterface(data.channels, "ifArray") = invalid or data.channels.Count() = 0
|
||||||
showPanel("guideError", "Program guide", "Could not load the schedule.", ["Retry"])
|
m.panelMode = "guideError"
|
||||||
|
m.guideStatus.text = "Schedule unavailable · OK Retry"
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
syncClock(data.serverTime)
|
syncClock(data.serverTime)
|
||||||
m.guideIds = []
|
|
||||||
m.guideChannels = data.channels
|
m.guideChannels = data.channels
|
||||||
titles = []
|
|
||||||
selected = 0
|
selected = 0
|
||||||
for each channel in m.guideChannels
|
for i = 0 to m.guideChannels.Count() - 1
|
||||||
if m.channelIndex >= 0 and channel.id = m.channels[m.channelIndex].id then selected = titles.Count()
|
if m.channelIndex >= 0 and m.guideChannels[i].id = m.channels[m.channelIndex].id then selected = i
|
||||||
titles.Push(channelLabel(channel))
|
|
||||||
m.guideIds.Push(channel.id)
|
|
||||||
end for
|
end for
|
||||||
selected = (selected + m.guideOffset + titles.Count()) mod titles.Count()
|
count = m.guideChannels.Count()
|
||||||
showPanel("guide", "Program guide", "Up / Down Browse OK Watch Star Options", titles)
|
m.guideSelected = (selected + m.guideOffset + count) mod count
|
||||||
m.menu.itemSize = [430, 50]
|
m.guideFirst = 0
|
||||||
m.guideDetails.visible = true
|
m.panelMode = "guide"
|
||||||
m.menu.jumpToItem = selected
|
m.guideRows.visible = true
|
||||||
showGuideDetails(selected)
|
m.guideStatus.text = "PROGRAM GUIDE Up / Down Browse OK Watch Back Close"
|
||||||
|
renderGuide()
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub onGuideFocus(event as object)
|
sub renderGuide()
|
||||||
if m.panelMode = "guide" then showGuideDetails(event.GetData())
|
if m.guideSelected < m.guideFirst then m.guideFirst = m.guideSelected
|
||||||
end sub
|
if m.guideSelected > m.guideFirst + 2 then m.guideFirst = m.guideSelected - 2
|
||||||
|
|
||||||
sub showGuideDetails(index as integer)
|
|
||||||
if index < 0 or index >= m.guideChannels.Count() then return
|
|
||||||
channel = m.guideChannels[index]
|
|
||||||
m.guideChannelTitle.text = channelLabel(channel)
|
|
||||||
m.guideNow.text = ""
|
|
||||||
m.guideNext.text = ""
|
|
||||||
m.guideLater.text = ""
|
|
||||||
if channel.type = "weather"
|
|
||||||
m.guideNow.text = "LOCAL WEATHER"
|
|
||||||
m.guideNext.text = "Current conditions, forecasts and alerts"
|
|
||||||
return
|
|
||||||
end if
|
|
||||||
|
|
||||||
now = currentEpoch()
|
now = currentEpoch()
|
||||||
upcoming = []
|
for i = 0 to 2
|
||||||
|
index = m.guideFirst + i
|
||||||
|
suffix = StrI(i).Trim()
|
||||||
|
row = m.top.FindNode("guideRow" + suffix)
|
||||||
|
row.visible = index < m.guideChannels.Count()
|
||||||
|
if row.visible
|
||||||
|
channel = m.guideChannels[index]
|
||||||
current = invalid
|
current = invalid
|
||||||
|
upcoming = invalid
|
||||||
for each program in channel.programs
|
for each program in channel.programs
|
||||||
if parseUtc(program.start) > now
|
if parseUtc(program.start) > now
|
||||||
upcoming.Push(program)
|
upcoming = program
|
||||||
|
exit for
|
||||||
else if parseUtc(program.stop) > now
|
else if parseUtc(program.stop) > now
|
||||||
current = program
|
current = program
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
m.guideNow.text = "NOW" + Chr(10) + programTitle(current)
|
m.top.FindNode("guideFill" + suffix).color = "0x1B2B48FF"
|
||||||
nextProgram = invalid
|
if index = m.guideSelected then m.top.FindNode("guideFill" + suffix).color = "0x376C89FF"
|
||||||
if upcoming.Count() > 0 then nextProgram = upcoming[0]
|
m.top.FindNode("guideChannel" + suffix).text = channelLabel(channel)
|
||||||
m.guideNext.text = "NEXT" + Chr(10) + programTitle(nextProgram)
|
m.top.FindNode("guideNow" + suffix).text = programTitle(current)
|
||||||
if upcoming.Count() > 1 then m.guideLater.text = "LATER" + Chr(10) + programTitle(upcoming[1])
|
if channel.type = "weather" then m.top.FindNode("guideNow" + suffix).text = "Local weather"
|
||||||
|
m.top.FindNode("guideNext" + suffix).text = programTitle(upcoming)
|
||||||
|
end if
|
||||||
|
end for
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
function handleGuideKey(key as string) as boolean
|
||||||
|
if key = "back"
|
||||||
|
if m.channelIndex < 0 then return false
|
||||||
|
closePanel()
|
||||||
|
else if key = "options"
|
||||||
|
showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"])
|
||||||
|
else if key = "ok" and m.panelMode = "guideError"
|
||||||
|
openGuide()
|
||||||
|
else if m.panelMode = "guide"
|
||||||
|
if key = "up" or key = "down"
|
||||||
|
direction = 1
|
||||||
|
if key = "up" then direction = -1
|
||||||
|
count = m.guideChannels.Count()
|
||||||
|
m.guideSelected = (m.guideSelected + direction + count) mod count
|
||||||
|
renderGuide()
|
||||||
|
else if key = "ok"
|
||||||
|
id = m.guideChannels[m.guideSelected].id
|
||||||
|
for i = 0 to m.channels.Count() - 1
|
||||||
|
if m.channels[i].id = id
|
||||||
|
closePanel()
|
||||||
|
if i <> m.channelIndex then tune(i)
|
||||||
|
exit for
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
sub init()
|
sub init()
|
||||||
for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideDetails", "guideChannelTitle", "guideNow", "guideNext", "guideLater", "remoteFocus"]
|
for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideOverlay", "guideStatus", "guideRows", "remoteFocus"]
|
||||||
m[id] = m.top.FindNode(id)
|
m[id] = m.top.FindNode(id)
|
||||||
end for
|
end for
|
||||||
m.channels = []
|
m.channels = []
|
||||||
@@ -11,7 +11,6 @@ sub init()
|
|||||||
m.clockReference = CreateObject("roTimespan")
|
m.clockReference = CreateObject("roTimespan")
|
||||||
|
|
||||||
m.menu.ObserveField("itemSelected", "onMenuSelect")
|
m.menu.ObserveField("itemSelected", "onMenuSelect")
|
||||||
m.menu.ObserveField("itemFocused", "onGuideFocus")
|
|
||||||
m.video.ObserveField("state", "onVideoState")
|
m.video.ObserveField("state", "onVideoState")
|
||||||
initWeather()
|
initWeather()
|
||||||
m.bannerTimer.ObserveField("fire", "hideBanner")
|
m.bannerTimer.ObserveField("fire", "hideBanner")
|
||||||
@@ -220,6 +219,7 @@ sub onSchedule(event as object)
|
|||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub showBanner()
|
sub showBanner()
|
||||||
|
if m.guideOverlay.visible then return
|
||||||
m.banner.visible = true
|
m.banner.visible = true
|
||||||
m.bannerTimer.control = "stop"
|
m.bannerTimer.control = "stop"
|
||||||
m.bannerTimer.control = "start"
|
m.bannerTimer.control = "start"
|
||||||
@@ -327,16 +327,14 @@ end sub
|
|||||||
|
|
||||||
function onKeyEvent(key as string, press as boolean) as boolean
|
function onKeyEvent(key as string, press as boolean) as boolean
|
||||||
if not press then return false
|
if not press then return false
|
||||||
|
key = LCase(key)
|
||||||
|
if m.guideOverlay.visible then return handleGuideKey(key)
|
||||||
if key = "back" and m.panel.visible and m.channelIndex >= 0
|
if key = "back" and m.panel.visible and m.channelIndex >= 0
|
||||||
closePanel()
|
closePanel()
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
if key = "options" and (m.channelIndex >= 0 or m.panelMode = "guide" or m.panelMode = "options")
|
if key = "options" and (m.channelIndex >= 0 or m.panelMode = "guide" or m.panelMode = "options")
|
||||||
if m.panelMode = "guide"
|
|
||||||
showPanel("options", "retroLabs", m.server.name + " " + m.server.baseUrl, ["Program guide", "Refresh channels", "Change server"])
|
|
||||||
else
|
|
||||||
openGuide()
|
openGuide()
|
||||||
end if
|
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
if m.panel.visible or m.channelIndex < 0 then return false
|
if m.panel.visible or m.channelIndex < 0 then return false
|
||||||
|
|||||||
@@ -91,16 +91,33 @@
|
|||||||
<LabelList id="menu" translation="[65,202]" itemSize="[1150,50]" itemSpacing="[0,4]"
|
<LabelList id="menu" translation="[65,202]" itemSize="[1150,50]" itemSpacing="[0,4]"
|
||||||
numRows="8" color="0xF8F7EFFF" focusedColor="0x101A32FF" font="font:SmallSystemFont"
|
numRows="8" color="0xF8F7EFFF" focusedColor="0x101A32FF" font="font:SmallSystemFont"
|
||||||
focusedFont="font:SmallBoldSystemFont" focusBitmapBlendColor="0x78E5EBFF" />
|
focusedFont="font:SmallBoldSystemFont" focusBitmapBlendColor="0x78E5EBFF" />
|
||||||
<Group id="guideDetails" translation="[520,202]" visible="false">
|
</Group>
|
||||||
<Rectangle width="690" height="432" color="0x1B2B48FF" />
|
<Group id="guideOverlay" translation="[50,446]" visible="false">
|
||||||
<Label id="guideChannelTitle" translation="[24,14]" width="640" height="45"
|
<Rectangle width="1180" height="224" color="0x101A32F2" />
|
||||||
font="font:MediumBoldSystemFont" color="0x78E5EBFF" />
|
<Rectangle width="1180" height="3" color="0x78E5EBFF" />
|
||||||
<Label id="guideNow" translation="[24,78]" width="640" height="100"
|
<Label id="guideStatus" translation="[18,9]" width="1144" height="36" font="font:SmallSystemFont" />
|
||||||
font="font:SmallSystemFont" wrap="true" numLines="3" />
|
<Group id="guideRows" translation="[12,46]">
|
||||||
<Label id="guideNext" translation="[24,192]" width="640" height="100"
|
<Label translation="[12,0]" width="230" height="30" text="CHANNEL" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||||
font="font:SmallSystemFont" wrap="true" numLines="3" />
|
<Label translation="[250,0]" width="440" height="30" text="NOW" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||||
<Label id="guideLater" translation="[24,306]" width="640" height="100"
|
<Label translation="[704,0]" width="440" height="30" text="NEXT" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||||
font="font:SmallSystemFont" wrap="true" numLines="3" />
|
<Group id="guideRow0" translation="[0,30]">
|
||||||
|
<Rectangle id="guideFill0" width="1156" height="44" color="0x1B2B48FF" />
|
||||||
|
<Label id="guideChannel0" translation="[12,0]" width="225" height="44" font="font:SmallBoldSystemFont" />
|
||||||
|
<Label id="guideNow0" translation="[250,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
<Label id="guideNext0" translation="[704,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
</Group>
|
||||||
|
<Group id="guideRow1" translation="[0,76]">
|
||||||
|
<Rectangle id="guideFill1" width="1156" height="44" color="0x1B2B48FF" />
|
||||||
|
<Label id="guideChannel1" translation="[12,0]" width="225" height="44" font="font:SmallBoldSystemFont" />
|
||||||
|
<Label id="guideNow1" translation="[250,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
<Label id="guideNext1" translation="[704,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
</Group>
|
||||||
|
<Group id="guideRow2" translation="[0,122]">
|
||||||
|
<Rectangle id="guideFill2" width="1156" height="44" color="0x1B2B48FF" />
|
||||||
|
<Label id="guideChannel2" translation="[12,0]" width="225" height="44" font="font:SmallBoldSystemFont" />
|
||||||
|
<Label id="guideNow2" translation="[250,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
<Label id="guideNext2" translation="[704,0]" width="440" height="44" font="font:SmallSystemFont" />
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Timer id="bannerTimer" duration="5" />
|
<Timer id="bannerTimer" duration="5" />
|
||||||
|
|||||||
Reference in New Issue
Block a user