diff --git a/README.md b/README.md
index d6f71c9..a259eff 100644
--- a/README.md
+++ b/README.md
@@ -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.
diff --git a/bridge/app.py b/bridge/app.py
index 9b921d2..09361e3 100644
--- a/bridge/app.py
+++ b/bridge/app.py
@@ -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")
diff --git a/roku/README.md b/roku/README.md
index 16a823d..ad7e848 100644
--- a/roku/README.md
+++ b/roku/README.md
@@ -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
diff --git a/roku/components/Guide.brs b/roku/components/Guide.brs
index 3037776..72e7c99 100644
--- a/roku/components/Guide.brs
+++ b/roku/components/Guide.brs
@@ -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
diff --git a/roku/components/RetroScene.brs b/roku/components/RetroScene.brs
index c5ae9b9..65e50ae 100644
--- a/roku/components/RetroScene.brs
+++ b/roku/components/RetroScene.brs
@@ -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
diff --git a/roku/components/RetroScene.xml b/roku/components/RetroScene.xml
index 8bf3c9c..b69f783 100644
--- a/roku/components/RetroScene.xml
+++ b/roku/components/RetroScene.xml
@@ -15,49 +15,45 @@
font="font:MediumBoldSystemFont" color="0x78E5EBFF" />
-
-
-
+
+
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
@@ -92,31 +88,31 @@
numRows="8" color="0xF8F7EFFF" focusedColor="0x101A32FF" font="font:SmallSystemFont"
focusedFont="font:SmallBoldSystemFont" focusBitmapBlendColor="0x78E5EBFF" />
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
diff --git a/roku/components/Weather.brs b/roku/components/Weather.brs
index 42ed269..6d70e9a 100644
--- a/roku/components/Weather.brs
+++ b/roku/components/Weather.brs
@@ -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()