Make the Roku guide full width and give weather its own audio
This commit is contained in:
@@ -36,7 +36,7 @@ The current host uses the NVIDIA Compose override for Tunarr's CUDA transcode pr
|
||||
|
||||
Tune to channel 99 in the retroLabs Roku app. This host is configured for Dunnellon, FL (34431). The screen rotates through current conditions, six hourly periods, three extended forecast cards with daily highs and lows, and sunrise/sunset. Active NWS alerts appear across the rotation. The bridge caches data and marks delayed responses.
|
||||
|
||||
To set a location on another host, set `RETROTV_WEATHER_POINT` (latitude,longitude) and `RETROTV_WEATHER_LOCATION` in `.env`, then run `docker compose up -d --no-deps bridge`. The bridge serves the feed at `/api/v1/weather`. Weather is rendered by the Roku app. Its muted live inset shows the last tuned linear channel, or the first linear channel when weather is opened directly. The inset shares the tuner's video player.
|
||||
To set a location on another host, set `RETROTV_WEATHER_POINT` (latitude,longitude) and `RETROTV_WEATHER_LOCATION` in `.env`, then run `docker compose up -d --no-deps bridge`. The bridge serves the feed at `/api/v1/weather`. Weather is rendered by the Roku app.
|
||||
|
||||
To add background music, place a local MP3 at `data/weather/forecast.mp3` on the bridge host. The file is served over the LAN and loops while the weather channel is open. The directory is mounted read-only in the bridge and ignored by Git.
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ def create_app(*, tunarr_url=None, transport=None, discover=True, id_file=None):
|
||||
data = await weather_provider.read()
|
||||
return {**data, "musicUrl": "/api/v1/weather/music.mp3" if weather_music.is_file() else None}
|
||||
|
||||
@app.get("/api/v1/weather/music.mp3")
|
||||
@app.api_route("/api/v1/weather/music.mp3", methods=["GET", "HEAD"])
|
||||
async def weather_audio():
|
||||
if not weather_music.is_file():
|
||||
raise HTTPException(404, "Weather music is not configured")
|
||||
|
||||
@@ -19,11 +19,11 @@ IP or hostname. Use `IP:port` if the bridge uses a port other than `4242`.
|
||||
|
||||
- **Up / Down** opens the guide on the adjacent channel. In the guide, it moves the highlight without tuning.
|
||||
- **OK** tunes the highlighted channel in the guide. During playback it shows the banner or retries a failed channel.
|
||||
- **Left / Replay** returns to the last channel.
|
||||
- **Left / Right** moves the guide time by 30 minutes. With the guide closed, Left or Replay returns to the last channel.
|
||||
- **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.
|
||||
|
||||
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.
|
||||
The app opens on the guide. The guide scrolls three channels at a time in a full-width guide across the bottom third 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.
|
||||
|
||||
## Desktop simulator
|
||||
|
||||
@@ -94,16 +94,19 @@ sub onGuide(event as object)
|
||||
count = m.guideChannels.Count()
|
||||
m.guideSelected = (selected + m.guideOffset + count) mod count
|
||||
m.guideFirst = 0
|
||||
m.guideMinutes = 0
|
||||
m.panelMode = "guide"
|
||||
m.guideRows.visible = true
|
||||
m.guideStatus.text = "PROGRAM GUIDE Up / Down Browse OK Watch Back Close"
|
||||
m.guideStatus.text = "PROGRAM GUIDE Up/Down Channels Left/Right Time OK Watch Back Close"
|
||||
renderGuide()
|
||||
end sub
|
||||
|
||||
sub renderGuide()
|
||||
if m.guideSelected < m.guideFirst then m.guideFirst = m.guideSelected
|
||||
if m.guideSelected > m.guideFirst + 2 then m.guideFirst = m.guideSelected - 2
|
||||
now = currentEpoch()
|
||||
viewTime = currentEpoch() + m.guideMinutes * 60
|
||||
m.guideTimeHeading.text = "NOW"
|
||||
if m.guideMinutes > 0 then m.guideTimeHeading.text = guideTime(viewTime)
|
||||
for i = 0 to 2
|
||||
index = m.guideFirst + i
|
||||
suffix = StrI(i).Trim()
|
||||
@@ -114,10 +117,10 @@ sub renderGuide()
|
||||
current = invalid
|
||||
upcoming = invalid
|
||||
for each program in channel.programs
|
||||
if parseUtc(program.start) > now
|
||||
if parseUtc(program.start) > viewTime
|
||||
upcoming = program
|
||||
exit for
|
||||
else if parseUtc(program.stop) > now
|
||||
else if parseUtc(program.stop) > viewTime
|
||||
current = program
|
||||
end if
|
||||
end for
|
||||
@@ -126,7 +129,9 @@ sub renderGuide()
|
||||
m.top.FindNode("guideChannel" + suffix).text = channelLabel(channel)
|
||||
m.top.FindNode("guideNow" + suffix).text = programTitle(current)
|
||||
if channel.type = "weather" then m.top.FindNode("guideNow" + suffix).text = "Local weather"
|
||||
m.top.FindNode("guideNext" + suffix).text = programTitle(upcoming)
|
||||
nextTitle = programTitle(upcoming)
|
||||
if upcoming <> invalid then nextTitle = guideTime(parseUtc(upcoming.start)) + " " + nextTitle
|
||||
m.top.FindNode("guideNext" + suffix).text = nextTitle
|
||||
end if
|
||||
end for
|
||||
end sub
|
||||
@@ -146,6 +151,10 @@ function handleGuideKey(key as string) as boolean
|
||||
count = m.guideChannels.Count()
|
||||
m.guideSelected = (m.guideSelected + direction + count) mod count
|
||||
renderGuide()
|
||||
else if key = "left" or key = "right"
|
||||
if key = "left" and m.guideMinutes > 0 then m.guideMinutes -= 30
|
||||
if key = "right" and m.guideMinutes < 150 then m.guideMinutes += 30
|
||||
renderGuide()
|
||||
else if key = "ok"
|
||||
id = m.guideChannels[m.guideSelected].id
|
||||
for i = 0 to m.channels.Count() - 1
|
||||
@@ -159,3 +168,14 @@ function handleGuideKey(key as string) as boolean
|
||||
end if
|
||||
return true
|
||||
end function
|
||||
|
||||
function guideTime(epoch as longinteger) as string
|
||||
clock = CreateObject("roDateTime")
|
||||
clock.FromSeconds(epoch)
|
||||
clock.ToLocalTime()
|
||||
hour = clock.GetHours() mod 12
|
||||
if hour = 0 then hour = 12
|
||||
meridiem = " AM"
|
||||
if clock.GetHours() >= 12 then meridiem = " PM"
|
||||
return hour.ToStr() + ":" + Right("0" + clock.GetMinutes().ToStr(), 2) + meridiem
|
||||
end function
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
sub init()
|
||||
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"]
|
||||
for each id in ["video", "weather", "banner", "channelTitle", "clock", "nowTitle", "nextTitle", "progressTrack", "progress", "playbackStatus", "panel", "panelTitle", "panelStatus", "menu", "bannerTimer", "clockTimer", "retryTimer", "guideOverlay", "guideStatus", "guideRows", "guideTimeHeading", "remoteFocus"]
|
||||
m[id] = m.top.FindNode(id)
|
||||
end for
|
||||
m.channels = []
|
||||
@@ -157,15 +157,14 @@ sub startPlayback()
|
||||
m.weather.visible = channel.type = "weather"
|
||||
m.playbackStatus.visible = false
|
||||
if m.weather.visible
|
||||
m.video.visible = false
|
||||
m.videoChannelId = invalid
|
||||
m.video.control = "stop"
|
||||
startWeather()
|
||||
return
|
||||
end if
|
||||
stopWeather()
|
||||
m.video.visible = true
|
||||
m.video.translation = [0, 0]
|
||||
m.video.width = 1280
|
||||
m.video.height = 720
|
||||
m.video.mute = false
|
||||
if m.videoChannelId = channel.id and m.video.state = "playing" then return
|
||||
setPlaybackStatus("Tuning…")
|
||||
playLinear(channel)
|
||||
@@ -300,10 +299,7 @@ end sub
|
||||
|
||||
sub onVideoState()
|
||||
restoreRemoteFocus()
|
||||
if m.weather.visible
|
||||
if m.video.state = "error" or m.video.state = "finished" then hideWeatherPreview()
|
||||
return
|
||||
end if
|
||||
if m.weather.visible then return
|
||||
if m.channelIndex < 0 then return
|
||||
if m.video.state = "playing"
|
||||
m.playbackStatus.visible = false
|
||||
|
||||
@@ -15,49 +15,45 @@
|
||||
font="font:MediumBoldSystemFont" color="0x78E5EBFF" />
|
||||
<Label id="weatherHeading" translation="[70,198]" width="1140" height="42"
|
||||
font="font:MediumBoldSystemFont" />
|
||||
<Rectangle translation="[66,248]" width="708" height="293" color="0xCF8B38FF" />
|
||||
<Rectangle translation="[69,251]" width="702" height="287" color="0x233A99FF" />
|
||||
<Label id="weatherBody" translation="[87,267]" width="663" height="285"
|
||||
<Rectangle translation="[66,248]" width="1148" height="293" color="0xCF8B38FF" />
|
||||
<Rectangle translation="[69,251]" width="1142" height="287" color="0x233A99FF" />
|
||||
<Label id="weatherBody" translation="[87,267]" width="1103" height="285"
|
||||
font="font:SmallSystemFont" wrap="true" numLines="8" />
|
||||
<Group id="forecastCards" translation="[70,251]" visible="false">
|
||||
<Group translation="[0,0]">
|
||||
<Rectangle width="232" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay0" translation="[8,9]" width="216" height="42"
|
||||
<Rectangle width="378" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay0" translation="[8,9]" width="362" height="42"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" color="0xFFE192FF" />
|
||||
<Label id="forecastCondition0" translation="[16,83]" width="200" height="100"
|
||||
<Label id="forecastCondition0" translation="[16,83]" width="346" height="100"
|
||||
horizAlign="center" vertAlign="center" wrap="true" numLines="3" font="font:SmallSystemFont" />
|
||||
<Label id="forecastTemps0" translation="[8,213]" width="216" height="50"
|
||||
<Label id="forecastTemps0" translation="[8,213]" width="362" height="50"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" />
|
||||
</Group>
|
||||
<Group translation="[234,0]">
|
||||
<Rectangle width="232" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay1" translation="[8,9]" width="216" height="42"
|
||||
<Group translation="[380,0]">
|
||||
<Rectangle width="378" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay1" translation="[8,9]" width="362" height="42"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" color="0xFFE192FF" />
|
||||
<Label id="forecastCondition1" translation="[16,83]" width="200" height="100"
|
||||
<Label id="forecastCondition1" translation="[16,83]" width="346" height="100"
|
||||
horizAlign="center" vertAlign="center" wrap="true" numLines="3" font="font:SmallSystemFont" />
|
||||
<Label id="forecastTemps1" translation="[8,213]" width="216" height="50"
|
||||
<Label id="forecastTemps1" translation="[8,213]" width="362" height="50"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" />
|
||||
</Group>
|
||||
<Group translation="[468,0]">
|
||||
<Rectangle width="232" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="226" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay2" translation="[8,9]" width="216" height="42"
|
||||
<Group translation="[760,0]">
|
||||
<Rectangle width="378" height="287" color="0xCE8B38FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="281" color="0x2943A8FF" />
|
||||
<Rectangle translation="[3,3]" width="372" height="54" color="0x342371FF" />
|
||||
<Label id="forecastDay2" translation="[8,9]" width="362" height="42"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" color="0xFFE192FF" />
|
||||
<Label id="forecastCondition2" translation="[16,83]" width="200" height="100"
|
||||
<Label id="forecastCondition2" translation="[16,83]" width="346" height="100"
|
||||
horizAlign="center" vertAlign="center" wrap="true" numLines="3" font="font:SmallSystemFont" />
|
||||
<Label id="forecastTemps2" translation="[8,213]" width="216" height="50"
|
||||
<Label id="forecastTemps2" translation="[8,213]" width="362" height="50"
|
||||
horizAlign="center" font="font:SmallBoldSystemFont" />
|
||||
</Group>
|
||||
</Group>
|
||||
<Rectangle id="weatherPreviewFrame" translation="[800,208]" width="416" height="238"
|
||||
color="0x78E5EBFF" visible="false" />
|
||||
<Label id="weatherPreviewLabel" translation="[802,454]" width="412" height="70"
|
||||
font="font:SmallBoldSystemFont" wrap="true" numLines="2" />
|
||||
<Label id="weatherAlerts" translation="[70,553]" width="1140" height="74"
|
||||
font="font:SmallBoldSystemFont" color="0xFFD57AFF" wrap="true" numLines="2" />
|
||||
<Rectangle translation="[0,637]" width="1280" height="83" color="0x171D54FF" />
|
||||
@@ -92,31 +88,31 @@
|
||||
numRows="8" color="0xF8F7EFFF" focusedColor="0x101A32FF" font="font:SmallSystemFont"
|
||||
focusedFont="font:SmallBoldSystemFont" focusBitmapBlendColor="0x78E5EBFF" />
|
||||
</Group>
|
||||
<Group id="guideOverlay" translation="[50,446]" visible="false">
|
||||
<Rectangle width="1180" height="224" color="0x101A32F2" />
|
||||
<Rectangle width="1180" height="3" color="0x78E5EBFF" />
|
||||
<Label id="guideStatus" translation="[18,9]" width="1144" height="36" font="font:SmallSystemFont" />
|
||||
<Group id="guideRows" translation="[12,46]">
|
||||
<Group id="guideOverlay" translation="[0,480]" visible="false">
|
||||
<Rectangle width="1280" height="240" color="0x101A32F2" />
|
||||
<Rectangle width="1280" height="3" color="0x78E5EBFF" />
|
||||
<Label id="guideStatus" translation="[52,9]" width="1176" height="36" font="font:SmallSystemFont" />
|
||||
<Group id="guideRows" translation="[40,46]">
|
||||
<Label translation="[12,0]" width="230" height="30" text="CHANNEL" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||
<Label translation="[250,0]" width="440" height="30" text="NOW" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||
<Label translation="[704,0]" width="440" height="30" text="NEXT" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||
<Label id="guideTimeHeading" translation="[250,0]" width="460" height="30" text="NOW" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||
<Label translation="[724,0]" width="464" height="30" text="NEXT" color="0x78E5EBFF" font="font:SmallBoldSystemFont" />
|
||||
<Group id="guideRow0" translation="[0,30]">
|
||||
<Rectangle id="guideFill0" width="1156" height="44" color="0x1B2B48FF" />
|
||||
<Rectangle id="guideFill0" width="1200" 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" />
|
||||
<Label id="guideNow0" translation="[250,0]" width="460" height="44" font="font:SmallSystemFont" />
|
||||
<Label id="guideNext0" translation="[724,0]" width="464" height="44" font="font:SmallSystemFont" />
|
||||
</Group>
|
||||
<Group id="guideRow1" translation="[0,76]">
|
||||
<Rectangle id="guideFill1" width="1156" height="44" color="0x1B2B48FF" />
|
||||
<Rectangle id="guideFill1" width="1200" 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" />
|
||||
<Label id="guideNow1" translation="[250,0]" width="460" height="44" font="font:SmallSystemFont" />
|
||||
<Label id="guideNext1" translation="[724,0]" width="464" height="44" font="font:SmallSystemFont" />
|
||||
</Group>
|
||||
<Group id="guideRow2" translation="[0,122]">
|
||||
<Rectangle id="guideFill2" width="1156" height="44" color="0x1B2B48FF" />
|
||||
<Rectangle id="guideFill2" width="1200" 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" />
|
||||
<Label id="guideNow2" translation="[250,0]" width="460" height="44" font="font:SmallSystemFont" />
|
||||
<Label id="guideNext2" translation="[724,0]" width="464" height="44" font="font:SmallSystemFont" />
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user