Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rorpage committed May 7, 2019
0 parents commit 43114dd
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
out
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "brightscript",
"request": "launch",
"name": "BrightScript Debug: Launch",
"stopOnEntry": true,
"host": "${promptForHost}",
"password": "${promptForPassword}",
"rootDir": "${workspaceFolder}",
"enableDebuggerAutoRecovery": false
}
]
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Quick start

Using your Roku remote, enter the following button sequence:

> :house: :house: :house: + :arrow_up_small: :arrow_up_small: + :arrow_forward: :arrow_backward: + :arrow_forward: :arrow_backward: + :arrow_forward:
Follow the steps to activate developer mode on your Roku device. Save the IP address at the end of the process (_example: `http://192.168.1.195`_)

Enter the following IP address in a web browser, log-in with username `rokudev` and the password you set during the developer mode process.

Take any of the .zip files and upload/install to the developer application installer. Your Roku device will load the sample channel instantly.
81 changes: 81 additions & 0 deletions components/NTunesScene.brs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
sub init()
m.top.setFocus(true)
m.is_playing = false

setUpLabels()

buildNTunesTask()

setUpRefreshTimer()

setUpAudio()

refreshData()
end sub

function setUpLabels() as void
m.current_track_title = m.top.findNode("current_track_title")
m.current_track_artist_name = m.top.findNode("current_track_artist_name")
m.current_show_name = m.top.findNode("current_show_name")
m.current_show_image_path = m.top.findNode("current_show_image_path")
end function

function buildNTunesTask() as void
m.nTunesTask = CreateObject("roSGNode", "NTunesTask")
m.nTunesTask.ObserveField("current_track_title", "onCurrentTrackTitleChanged")
m.nTunesTask.ObserveField("current_track_artist_name", "onCurrentTrackArtistNameChanged")
m.nTunesTask.ObserveField("current_show_name", "onCurrentShowNameChanged")
m.nTunesTask.ObserveField("current_show_image_path", "onCurrentShowImagePathChanged")
end function

function setUpRefreshTimer() as void
m.refresh_timer = m.top.findNode("refresh_timer")
m.refresh_timer.control = "start"
m.refresh_timer.ObserveField("fire", "refreshData")
end function

function setUpAudio() as void
audiocontent = createObject("RoSGNode", "ContentNode")
audiocontent.url = "https://wdwnt.out.airtime.pro/wdwnt_a"

m.audio = m.top.findNode("audio_player")
m.audio.content = audiocontent
end function

function refreshData() as void
m.nTunesTask.control = "RUN"
end function

function onKeyEvent(key as String, press as Boolean) as Boolean
handled = false

if press then
if (key = "play") then
if (m.is_playing) then
m.audio.control = "stop"
m.is_playing = false
else
m.audio.control = "play"
m.is_playing = true
end if

handled = true
endif
endif
end function

function onCurrentTrackTitleChanged() as void
m.current_track_title.text = m.nTunesTask.current_track_title
end function

function onCurrentTrackArtistNameChanged() as void
m.current_track_artist_name.text = m.nTunesTask.current_track_artist_name
end function

function onCurrentShowNameChanged() as void
m.current_show_name.text = m.nTunesTask.current_show_name
end function

function onCurrentShowImagePathChanged() as void
m.current_show_image_path.uri = m.nTunesTask.current_show_image_path
end function
36 changes: 36 additions & 0 deletions components/NTunesScene.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="NTunesScene" extends="Scene" xsi:noNamespaceSchemaLocation="https://devtools.web.roku.com/schema/RokuSceneGraph.xsd" initialFocus="audio_control_button">
<script type="text/brightscript" uri="pkg:/components/NTunesScene.brs" />
<children>
<Group id="artwork">
<Poster
id="current_show_image_path"
width="500"
height="500"
translation="[100, 100]" />
</Group>
<Group id="song_info">
<Label id="title" text="Now Playing" font="font:LargeBoldSystemFont" translation="[700, 100]" />
<Label id="current_track_title" font="font:MediumBoldSystemFont" text="Loading..." translation="[700, 160]" />
<Label id="current_track_artist_name" translation="[700, 220]" />
<Label id="current_show_name" translation="[700, 280]" />
</Group>
<Group id="control_buttons">
<!-- <Label
id="Play"
color="0xFFFFFFFF"
width="100"
height="120"
text="N"
translation="[910,10]">
<Font
id="Sosa-Regular"
role="font"
uri="pkg:/fonts/sosa-regular-webfont.ttf"
size="90" />
</Label> -->
</Group>
<Audio id="audio_player" />
<Timer id="refresh_timer" repeat="true" duration="5" />
</children>
</component>
36 changes: 36 additions & 0 deletions components/NTunesTask.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>

<component name="NTunesTask" extends="Task">

<interface>
<field id="current_track_title" type="string" />
<field id="current_track_artist_name" type="string" />
<field id="current_show_name" type="string" />
<field id="current_show_image_path" type="string" />
</interface>

<script type="text/brightscript">
<![CDATA[
sub init()
m.top.functionName = "executeTask"
end sub
function executeTask() as void
url = CreateObject("roUrlTransfer")
url.SetCertificatesFile("common:/certs/ca-bundle.crt")
url.InitClientCertificates()
url.setUrl("https://fastpass.wdwnt.com/radio")
json = ParseJson(url.GetToString())
m.top.current_track_title = json.current.metadata.track_title
m.top.current_track_artist_name = json.current.metadata.artist_name
m.top.current_show_name = json.currentShow[0].name
m.top.current_show_image_path = json.currentShow[0].image_path
end function
]]>
</script>

</component>
Binary file added fonts/avenirltstd-light-webfont.ttf
Binary file not shown.
Binary file added fonts/sosa-regular-webfont.ttf
Binary file not shown.
Binary file added images/channeltv-poster-hd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/nova_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Channel Details
title=WDW News Today
subtitle=The worldwide leader in Disney Parks News
major_version=1
minor_version=0
build_version=00001

# Channel Assets
mm_icon_focus_hd=pkg:/images/channeltv-poster-hd.png
mm_icon_focus_sd=pkg:/images/channeltv-poster-hd.png
mm_icon_side_hd=pkg:/images/channeltv-poster-hd.png
mm_icon_side_sd=pkg:/images/channeltv-poster-hd.png

# Splash Screen + Loading Screen Artwork
splash_screen_sd=pkg:/images/nova_bg.png
splash_screen_hd=pkg:/images/nova_bg.png
splash_screen_fhd=pkg:/images/nova_bg.png
splash_color=#1b7bf3
splash_min_time=3000

# Resolution
ui_resolutions=fhd
22 changes: 22 additions & 0 deletions source/main.brs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
sub Main()
showChannelSGScreen()
end sub

sub showChannelSGScreen()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)

scene = screen.CreateScene("NTunesScene")
screen.Show()

while true
msg = wait(0, m.port)
if (msg <> invalid)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end if
end while
end sub

0 comments on commit 43114dd

Please sign in to comment.