Merge pull request #423 from neilsb/deep-linking
Enable basic deep linking
This commit is contained in:
commit
b1191d0e23
|
@ -305,6 +305,16 @@
|
|||
<translation>Connecting to Server</translation>
|
||||
<extracomment>Message to display to user while client is attempting to connect to the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not found</source>
|
||||
<translation>Not found</translation>
|
||||
<extracomment>Title of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>The requested content does not exist on the server</source>
|
||||
<translation>The requested content does not exist on the server</translation>
|
||||
<extracomment>Content of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name></name>
|
||||
|
|
|
@ -419,5 +419,15 @@
|
|||
<translation>Connecting to Server</translation>
|
||||
<extracomment>Message to display to user while client is attempting to connect to the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not found</source>
|
||||
<translation>Not found</translation>
|
||||
<extracomment>Title of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>The requested content does not exist on the server</source>
|
||||
<translation>The requested content does not exist on the server</translation>
|
||||
<extracomment>Content of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -419,5 +419,15 @@
|
|||
<translation>Connecting to Server</translation>
|
||||
<extracomment>Message to display to user while client is attempting to connect to the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>Not found</source>
|
||||
<translation>Not found</translation>
|
||||
<extracomment>Title of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
<message>
|
||||
<source>The requested content does not exist on the server</source>
|
||||
<translation>The requested content does not exist on the server</translation>
|
||||
<extracomment>Content of message box when the requested content is not found on the server</extracomment>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
sub Main()
|
||||
|
||||
function Main (args as Dynamic) as Void
|
||||
|
||||
' If the Rooibos files are included in deployment, run tests
|
||||
'bs:disable-next-line
|
||||
if (type(Rooibos__Init) = "Function") then Rooibos__Init()
|
||||
|
@ -50,6 +50,31 @@ sub Main()
|
|||
m.device.setMessagePort(m.port)
|
||||
m.device.EnableScreensaverExitedEvent(true)
|
||||
|
||||
' Check if we were sent content to play with the startup command (Deep Link)
|
||||
if (args.mediaType <> invalid) and (args.contentId <> invalid)
|
||||
video = CreateVideoPlayerGroup(args.contentId)
|
||||
|
||||
if video <> invalid then
|
||||
if group.lastFocus = invalid then group.lastFocus = group.focusedChild
|
||||
group.setFocus(false)
|
||||
group.visible = false
|
||||
group = video
|
||||
m.scene.appendChild(group)
|
||||
group.setFocus(true)
|
||||
group.control = "play"
|
||||
ReportPlayback(group, "start")
|
||||
m.overhang.visible = false
|
||||
else
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.id = "OKDialog"
|
||||
dialog.title = tr("Not found")
|
||||
dialog.message = tr("The requested content does not exist on the server")
|
||||
dialog.buttons = [tr("OK")]
|
||||
m.scene.dialog = dialog
|
||||
m.scene.dialog.observeField("buttonSelected", m.port)
|
||||
end if
|
||||
end if
|
||||
|
||||
' This is the core logic loop. Mostly for transitioning between scenes
|
||||
' This now only references m. fields so could be placed anywhere, in theory
|
||||
' "group" is always "whats on the screen"
|
||||
|
@ -59,6 +84,7 @@ sub Main()
|
|||
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
||||
print "CLOSING SCREEN"
|
||||
return
|
||||
|
||||
else if isNodeEvent(msg, "backPressed")
|
||||
n = m.scene.getChildCount() - 1
|
||||
if msg.getRoSGNode().focusedChild <> invalid and msg.getRoSGNode().focusedChild.isSubtype("JFVideo")
|
||||
|
@ -284,7 +310,7 @@ sub Main()
|
|||
else if isNodeEvent(msg, "buttonSelected")
|
||||
' If a button is selected, we have some determining to do
|
||||
btn = getButton(msg)
|
||||
if btn.id = "play-button"
|
||||
if btn <> invalid and btn.id = "play-button"
|
||||
' Check is a specific Audio Stream was selected
|
||||
audio_stream_idx = 1
|
||||
if group.selectedAudioStreamIndex <> invalid
|
||||
|
@ -306,7 +332,7 @@ sub Main()
|
|||
ReportPlayback(group, "start")
|
||||
m.overhang.visible = false
|
||||
end if
|
||||
else if btn.id = "watched-button"
|
||||
else if btn <> invalid and btn.id = "watched-button"
|
||||
movie = group.itemContent
|
||||
if movie.watched
|
||||
UnmarkItemWatched(movie.id)
|
||||
|
@ -314,7 +340,7 @@ sub Main()
|
|||
MarkItemWatched(movie.id)
|
||||
end if
|
||||
movie.watched = not movie.watched
|
||||
else if btn.id = "favorite-button"
|
||||
else if btn <> invalid and btn.id = "favorite-button"
|
||||
movie = group.itemContent
|
||||
if movie.favorite
|
||||
UnmarkItemFavorite(movie.id)
|
||||
|
@ -413,13 +439,39 @@ sub Main()
|
|||
print "Unhandled roDeviceInfoEvent:"
|
||||
print msg.GetInfo()
|
||||
end if
|
||||
else if type(msg) = "roInputEvent"
|
||||
if msg.IsInput()
|
||||
info = msg.GetInfo()
|
||||
if info.DoesExist("mediatype") and info.DoesExist("contentid")
|
||||
video = CreateVideoPlayerGroup(info.contentId)
|
||||
if video <> invalid then
|
||||
if group.lastFocus = invalid then group.lastFocus = group.focusedChild
|
||||
group.setFocus(false)
|
||||
group.visible = false
|
||||
group = video
|
||||
m.scene.appendChild(group)
|
||||
group.setFocus(true)
|
||||
group.control = "play"
|
||||
ReportPlayback(group, "start")
|
||||
m.overhang.visible = false
|
||||
else
|
||||
dialog = createObject("roSGNode", "Dialog")
|
||||
dialog.id = "OKDialog"
|
||||
dialog.title = tr("Not found")
|
||||
dialog.message = tr("The requested content does not exist on the server")
|
||||
dialog.buttons = [tr("OK")]
|
||||
m.scene.dialog = dialog
|
||||
m.scene.dialog.observeField("buttonSelected", m.port)
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
else
|
||||
print "Unhandled " type(msg)
|
||||
print msg
|
||||
end if
|
||||
end while
|
||||
|
||||
end sub
|
||||
end function
|
||||
|
||||
function LoginFlow(startOver = false as boolean)
|
||||
if m.scene <> invalid then
|
||||
|
@ -576,4 +628,5 @@ sub SendPerformanceBeacon(signalName as string)
|
|||
if m.global.app_loaded = false then
|
||||
m.scene.signalBeacon(signalName)
|
||||
end if
|
||||
end sub
|
||||
end sub
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ function VideoContent(video, audio_stream_idx = 1) as object
|
|||
params = {}
|
||||
|
||||
meta = ItemMetaData(video.id)
|
||||
if meta = invalid return invalid
|
||||
video.content.title = meta.title
|
||||
video.showID = meta.showID
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ function ItemMetaData(id as string)
|
|||
url = Substitute("Users/{0}/Items/{1}", get_setting("active_user"), id)
|
||||
resp = APIRequest(url)
|
||||
data = getJson(resp)
|
||||
if data = invalid then return invalid
|
||||
imgParams = {}
|
||||
if data.UserData.PlayedPercentage <> invalid then
|
||||
param = { "PercentPlayed": data.UserData.PlayedPercentage }
|
||||
|
|
|
@ -16,8 +16,8 @@ end function
|
|||
|
||||
function getButton(msg, subnode = "buttons" as string) as object
|
||||
buttons = msg.getRoSGNode().findNode(subnode)
|
||||
if buttons = invalid return invalid
|
||||
active_button = buttons.focusedChild
|
||||
|
||||
return active_button
|
||||
end function
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user