Make the Roku guide full width and give weather its own audio

This commit is contained in:
Josh
2026-11-13 15:30:02 -05:00
parent 131ebf5057
commit 68dc43e1b0
7 changed files with 76 additions and 101 deletions

View File

@@ -1,5 +1,5 @@
sub initWeather()
for each id in ["weatherLocation", "weatherHeading", "weatherBody", "weatherAlerts", "weatherSource", "weatherRotation", "weatherRefresh", "weatherAudio", "weatherPreviewFrame", "weatherPreviewLabel", "forecastCards"]
for each id in ["weatherLocation", "weatherHeading", "weatherBody", "weatherAlerts", "weatherSource", "weatherRotation", "weatherRefresh", "weatherAudio", "forecastCards"]
m[id] = m.top.FindNode(id)
end for
m.weatherAudio.ObserveField("state", "restoreRemoteFocus")
@@ -17,48 +17,10 @@ sub startWeather()
m.weatherBody.text = ""
m.weatherAlerts.text = ""
m.weatherSource.text = ""
startWeatherPreview()
refreshWeather()
m.weatherRefresh.control = "start"
end sub
sub startWeatherPreview()
preview = invalid
if m.previousIndex >= 0 and m.previousIndex < m.channels.Count()
candidate = m.channels[m.previousIndex]
if candidate.type = "linear" then preview = candidate
end if
if preview = invalid
for each candidate in m.channels
if candidate.type = "linear"
preview = candidate
exit for
end if
end for
end if
if preview = invalid
hideWeatherPreview()
return
end if
m.video.translation = [804, 212]
m.video.width = 408
m.video.height = 230
m.video.mute = true
m.video.visible = true
m.weatherPreviewFrame.visible = true
m.weatherPreviewLabel.text = "LIVE " + channelLabel(preview)
if m.videoChannelId <> preview.id or m.video.state <> "playing" then playLinear(preview)
end sub
sub hideWeatherPreview()
m.video.visible = false
m.video.control = "stop"
m.videoChannelId = invalid
m.weatherPreviewFrame.visible = false
m.weatherPreviewLabel.text = ""
end sub
sub stopWeather()
m.weatherAudio.control = "stop"
m.weatherMusicUrl = invalid
@@ -158,13 +120,14 @@ function tempLabel(value as dynamic) as string
end function
sub updateWeatherMusic(path as dynamic)
if path = m.weatherMusicUrl then return
if path = m.weatherMusicUrl and m.weatherAudio.state <> "error" then return
m.weatherAudio.control = "stop"
m.weatherMusicUrl = path
if GetInterface(path, "ifString") = invalid or path = "" then return
track = CreateObject("roSGNode", "ContentNode")
track.url = m.server.baseUrl + path
track.streamFormat = "mp3"
m.weatherAudio.mute = false
m.weatherAudio.content = track
m.weatherAudio.control = "play"
restoreRemoteFocus()