2019-03-07 03:14:52 +00:00
|
|
|
sub ShowServerSelect()
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("ConfigScene")
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
2019-03-07 03:14:52 +00:00
|
|
|
scene.findNode("prompt").text = "Connect to Serviette"
|
|
|
|
|
|
|
|
config = scene.findNode("configOptions")
|
|
|
|
items = [
|
|
|
|
{"field": "server", "label": "Host", "type": "string"},
|
|
|
|
{"field": "port", "label": "Port", "type": "string"}
|
|
|
|
]
|
|
|
|
config.callfunc("setData", items)
|
|
|
|
|
|
|
|
button = scene.findNode("submit")
|
|
|
|
button.observeField("buttonSelected", port)
|
|
|
|
|
|
|
|
server_hostname = config.content.getChild(0)
|
|
|
|
server_port = config.content.getChild(1)
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed()
|
|
|
|
return
|
|
|
|
else if type(msg) = "roSGNodeEvent"
|
|
|
|
node = msg.getNode()
|
|
|
|
if node = "submit"
|
|
|
|
set_setting("server", server_hostname.value)
|
|
|
|
set_setting("port", server_port.value)
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end while
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub ShowSignInSelect()
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("ConfigScene")
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
2019-03-07 03:14:52 +00:00
|
|
|
scene.findNode("prompt").text = "Sign In"
|
|
|
|
|
|
|
|
config = scene.findNode("configOptions")
|
|
|
|
items = [
|
|
|
|
{"field": "username", "label": "Username", "type": "string"},
|
|
|
|
{"field": "password", "label": "Password", "type": "password"}
|
|
|
|
]
|
|
|
|
config.callfunc("setData", items)
|
|
|
|
|
|
|
|
button = scene.findNode("submit")
|
|
|
|
button.observeField("buttonSelected", port)
|
|
|
|
|
|
|
|
config = scene.findNode("configOptions")
|
|
|
|
|
|
|
|
username = config.content.getChild(0)
|
|
|
|
password = config.content.getChild(1)
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed()
|
|
|
|
return
|
|
|
|
else if type(msg) = "roSGNodeEvent"
|
|
|
|
node = msg.getNode()
|
|
|
|
if node = "submit"
|
|
|
|
' Validate credentials
|
|
|
|
get_token(username.value, password.value)
|
|
|
|
if get_setting("active_user") <> invalid then return
|
|
|
|
print "Login attempt failed..."
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end while
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub ShowLibrarySelect()
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("Library")
|
|
|
|
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
|
|
|
|
2019-03-07 03:14:52 +00:00
|
|
|
library = scene.findNode("LibrarySelect")
|
|
|
|
libs = LibraryList()
|
|
|
|
library.libList = libs
|
|
|
|
|
|
|
|
library.observeField("itemSelected", port)
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
|
|
|
exit while
|
2019-03-10 05:28:28 +00:00
|
|
|
else if nodeEventQ(msg, "itemSelected")
|
2019-03-07 03:14:52 +00:00
|
|
|
target = getMsgRowTarget(msg)
|
|
|
|
if target.libraryType = "movies"
|
|
|
|
ShowMovieOptions(target.libraryID)
|
|
|
|
else
|
|
|
|
print "Library type is not yet implemented"
|
|
|
|
end if
|
|
|
|
end if
|
|
|
|
end while
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub ShowMovieOptions(library_id)
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("Movies")
|
|
|
|
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
|
|
|
|
2019-03-07 03:14:52 +00:00
|
|
|
options = scene.findNode("MovieSelect")
|
2019-03-09 22:09:21 +00:00
|
|
|
options_list = ItemList(library_id, {"limit": 30,
|
|
|
|
"page": 1,
|
|
|
|
"SortBy": "DateCreated,SortName",
|
|
|
|
"SortOrder": "Descending" })
|
2019-03-07 03:14:52 +00:00
|
|
|
options.movieData = options_list
|
|
|
|
|
2019-03-09 22:09:21 +00:00
|
|
|
options.observeField("itemFocused", port)
|
2019-03-07 03:14:52 +00:00
|
|
|
options.observeField("itemSelected", port)
|
|
|
|
|
|
|
|
while true
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
|
|
|
return
|
2019-03-10 05:28:28 +00:00
|
|
|
else if nodeEventQ(msg, "itemSelected")
|
2019-03-07 03:14:52 +00:00
|
|
|
target = getMsgRowTarget(msg)
|
2019-03-08 03:47:10 +00:00
|
|
|
ShowMovieDetails(target.movieID)
|
|
|
|
'showVideoPlayer(target.movieID)
|
2019-03-10 05:28:28 +00:00
|
|
|
else if nodeEventQ(msg, "itemFocused")
|
2019-03-09 22:23:57 +00:00
|
|
|
'print "Selected " + msg.getNode()
|
2019-03-08 03:47:10 +00:00
|
|
|
end if
|
|
|
|
end while
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub ShowMovieDetails(movie_id)
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("MovieItemDetailScene")
|
|
|
|
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
|
|
|
|
2019-03-08 03:47:10 +00:00
|
|
|
scene.itemJson = ItemMetaData(movie_id)
|
|
|
|
|
2019-03-09 22:23:57 +00:00
|
|
|
buttons = scene.findNode("buttons")
|
|
|
|
buttons.observeField("buttonSelected", port)
|
|
|
|
|
2019-03-08 03:47:10 +00:00
|
|
|
while true
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
|
|
|
return
|
2019-03-10 05:28:28 +00:00
|
|
|
else if nodeEventQ(msg, "buttonSelected")
|
2019-03-09 22:23:57 +00:00
|
|
|
button = msg.getROSGNode()
|
|
|
|
if button.buttonSelected = 0
|
|
|
|
showVideoPlayer(movie_id)
|
|
|
|
end if
|
2019-03-09 22:09:21 +00:00
|
|
|
else
|
|
|
|
print msg
|
|
|
|
print type(msg)
|
2019-03-07 03:14:52 +00:00
|
|
|
end if
|
|
|
|
end while
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub showVideoPlayer(id)
|
|
|
|
port = CreateObject("roMessagePort")
|
|
|
|
screen = CreateObject("roSGScreen")
|
|
|
|
screen.setMessagePort(port)
|
|
|
|
scene = screen.CreateScene("Scene")
|
|
|
|
|
|
|
|
screen.show()
|
|
|
|
|
2019-03-10 05:28:28 +00:00
|
|
|
themeScene(scene)
|
|
|
|
|
2019-03-07 03:14:52 +00:00
|
|
|
VideoPlayer(scene, id)
|
|
|
|
|
|
|
|
while true
|
|
|
|
msg = wait(0, port)
|
|
|
|
if type(msg) = "roSGScreenEvent" and msg.isScreenClosed() then
|
|
|
|
return
|
|
|
|
end if
|
|
|
|
end while
|
|
|
|
|
|
|
|
end sub
|