mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2025-02-02 20:44:56 +00:00
Actually populate LibraryList with real lib names
This commit is contained in:
parent
a20d6c96c8
commit
346cba23bc
@ -1,91 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="ConfigList" extends="MarkupList">
|
||||
<interface>
|
||||
<field id="SelectedItem" type="int" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ConfigItem"
|
||||
m.top.content = getData()
|
||||
<children>
|
||||
<Button
|
||||
id="submit"
|
||||
text="Submit"
|
||||
translation="[0, 500]"
|
||||
/>
|
||||
|
||||
m.top.drawFocusFeedback = false ' We're going to draw our own focus
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
</children>
|
||||
<interface>
|
||||
<field id="SelectedItem" type="int" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/config.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "ConfigItem"
|
||||
m.top.content = getData()
|
||||
|
||||
m.top.observeField("itemSelected", "onItemSelected")
|
||||
m.top.drawFocusFeedback = false ' We're going to draw our own focus
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
|
||||
m.top.setfocus(true)
|
||||
m.top.observeField("itemSelected", "onItemSelected")
|
||||
|
||||
end sub
|
||||
m.top.setfocus(true)
|
||||
|
||||
function getData()
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
end sub
|
||||
|
||||
items = [
|
||||
{"field": "server", "label": "Host"},
|
||||
{"field": "port", "label": "Port"}
|
||||
]
|
||||
function getData()
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
|
||||
for each item in items
|
||||
config = data.CreateChild("ConfigItemData")
|
||||
config.labelText = item["label"]
|
||||
config.valueText = get_setting(item["field"])
|
||||
items = [
|
||||
{"field": "server", "label": "Host"},
|
||||
{"field": "port", "label": "Port"}
|
||||
]
|
||||
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
for each item in items
|
||||
config = data.CreateChild("ConfigItemData")
|
||||
config.labelText = item["label"]
|
||||
config.valueText = get_setting(item["field"])
|
||||
|
||||
function onItemSelected()
|
||||
i = m.top.itemSelected
|
||||
itemField = m.top.content.getchild(i)
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
|
||||
show_dialog(itemField)
|
||||
function onItemSelected()
|
||||
i = m.top.itemSelected
|
||||
itemField = m.top.content.getchild(i)
|
||||
|
||||
end function
|
||||
show_dialog(itemField)
|
||||
|
||||
function onDialogButton()
|
||||
d = m.dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
end function
|
||||
|
||||
if button_text = "OK"
|
||||
m.configField.valueText = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
function onDialogButton()
|
||||
d = m.dialog
|
||||
button_text = d.buttons[d.buttonSelected]
|
||||
|
||||
if button_text = "OK"
|
||||
m.configField.valueText = d.text
|
||||
dismiss_dialog()
|
||||
return true
|
||||
else if button_text = "Cancel"
|
||||
dismiss_dialog()
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
sub show_dialog(configField)
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
m.configField = configField
|
||||
dialog.title = "Enter the " + configField.labelText
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
sub show_dialog(configField)
|
||||
dialog = createObject("roSGNode", "KeyboardDialog")
|
||||
m.configField = configField
|
||||
dialog.title = "Enter the " + configField.labelText
|
||||
dialog.buttons = ["OK", "Cancel"]
|
||||
|
||||
if configField.valueText <> "" then
|
||||
dialog.text = configField.valueText
|
||||
end if
|
||||
if configField.valueText <> "" then
|
||||
dialog.text = configField.valueText
|
||||
end if
|
||||
|
||||
m.top.getparent().dialog = dialog
|
||||
m.dialog = dialog
|
||||
m.top.getparent().dialog = dialog
|
||||
m.dialog = dialog
|
||||
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end sub
|
||||
dialog.observeField("buttonSelected", "onDialogButton")
|
||||
end sub
|
||||
|
||||
sub dismiss_dialog()
|
||||
m.dialog.close = true
|
||||
end sub
|
||||
sub dismiss_dialog()
|
||||
m.dialog.close = true
|
||||
end sub
|
||||
|
||||
function submit()
|
||||
' TODO - get proper field names, and set_setting
|
||||
for each content in m.top.content.getchildren(-1, 0)
|
||||
print content.labelText + ": " + content.valueText
|
||||
'set_setting(?field_name, content.valueText)
|
||||
end for
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
function submit()
|
||||
' TODO - get proper field names, and set_setting
|
||||
for each content in m.top.content.getchildren(-1, 0)
|
||||
print content.labelText + ": " + content.valueText
|
||||
'set_setting(?field_name, content.valueText)
|
||||
end for
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
||||
|
@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="LibItem" extends="Group">
|
||||
<children>
|
||||
<LayoutGroup layoutDirection="vert" vertAlignment="top" itemSpacings="20" translation="[0,0]" >
|
||||
<Poster id="itemImage" translation="[0,0]" width="200" height="300" />
|
||||
<Label id="itemText" horizAlign="center" translation="[0,0]" font="font:MediumSystemFont" width="196" height="65" />
|
||||
</LayoutGroup>
|
||||
<Label id="itemText" horizAlign="center" translation="[0,25]" font="font:MediumSystemFont" width="196" height="65" />
|
||||
</children>
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged"/>
|
||||
@ -13,14 +10,12 @@
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub Init()
|
||||
m.itemImage = m.top.findNode("itemImage")
|
||||
m.itemText = m.top.findNode("itemText")
|
||||
m.itemText.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
itemData = m.top.itemContent
|
||||
m.itemImage.uri = itemData.posterUrl
|
||||
m.itemText.text = itemData.labelText
|
||||
end function
|
||||
]]>
|
||||
|
@ -10,10 +10,7 @@
|
||||
translation="[150, 250]"
|
||||
itemSize="[440, 40]"
|
||||
itemSpacing="[0, 20]"
|
||||
numRows="12" >
|
||||
|
||||
</ConfigList>
|
||||
|
||||
numRows="12" />
|
||||
</children>
|
||||
|
||||
<interface>
|
||||
|
@ -1,39 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="LibraryRow" extends="RowList">
|
||||
<interface>
|
||||
<field id="RowSelectedItem" type="int" />
|
||||
<field id="libname" type="string" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "LibItem"
|
||||
m.top.numRows = 1
|
||||
m.top.content = getData()
|
||||
m.top.visible = true
|
||||
m.top.itemSize = [200 * 3 + 20 * 2, 365]
|
||||
m.top.rowHeights = [365]
|
||||
m.top.rowItemSize = [ [200, 365], [200, 365], [200, 365] ]
|
||||
m.top.itemSpacing = [ 0, 80 ]
|
||||
m.top.rowItemSpacing = [ [20, 0] ]
|
||||
m.top.rowLabelOffset = [ [0, 30] ]
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
m.top.showRowLabel = [true, true]
|
||||
m.top.rowLabelColor="0xa0b033ff"
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
<interface>
|
||||
<field id="RowSelectedItem" type="int" />
|
||||
<field id="rowSize" type="int" />
|
||||
<field id="libList" type="associativearray" onChange="setData" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/config.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/JellyfinAPI.brs" />
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub init()
|
||||
m.top.itemComponentName = "LibItem"
|
||||
m.top.numrows = 1
|
||||
m.top.rowSize = 4
|
||||
m.top.content = getData()
|
||||
m.top.visible = true
|
||||
m.top.itemSize = [200 * 5 + 20 * 4, 70]
|
||||
m.top.rowHeights = [70]
|
||||
m.top.rowItemSize = [ [200, 70], [200, 70], [200, 70] ]
|
||||
m.top.itemSpacing = [ 0, 70 ]
|
||||
m.top.rowItemSpacing = [ [20, 0] ]
|
||||
m.top.rowLabelOffset = [ [0, 30] ]
|
||||
m.top.rowFocusAnimationStyle = "floatingFocus"
|
||||
m.top.vertFocusAnimationStyle = "floatingFocus"
|
||||
m.top.showRowLabel = [true, true]
|
||||
m.top.rowLabelColor="0xa0b033ff"
|
||||
m.top.setfocus(true)
|
||||
end sub
|
||||
|
||||
function getData()
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
row = data.CreateChild("ContentNode")
|
||||
row.title = "Libraries"
|
||||
for i=1 to 3
|
||||
item = row.CreateChild("LibItemData")
|
||||
item.posterUrl = "http://devtools.web.roku.com/samples/images/Landscape_1.jpg"
|
||||
item.labelText = "Placeholder" + stri(i)
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
function setData()
|
||||
libs = m.top.liblist
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = libs.TotalRecordCount
|
||||
|
||||
' Test for no remainder
|
||||
if int(n/rowsize) = n/rowsize then
|
||||
m.top.numRows = n/rowsize
|
||||
else
|
||||
m.top.numRows = n/rowsize + 1
|
||||
end if
|
||||
|
||||
m.top.content = getData()
|
||||
end function
|
||||
|
||||
function getData()
|
||||
if m.top.libList = invalid then
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
return data
|
||||
end if
|
||||
|
||||
libs = m.top.libList
|
||||
rowsize = m.top.rowSize
|
||||
data = CreateObject("roSGNode", "ContentNode")
|
||||
for rownum=1 to m.top.numRows
|
||||
row = data.CreateChild("ContentNode")
|
||||
for i=1 to rowsize
|
||||
index = (rownum - 1) * rowsize + i
|
||||
if index > libs.TotalRecordCount then
|
||||
exit for
|
||||
end if
|
||||
datum = libs.Items[index-1]
|
||||
item = row.CreateChild("LibItemData")
|
||||
item.labelText = datum.name
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
||||
|
@ -71,6 +71,7 @@ function get_token(user as String, password as String)
|
||||
hashed_pass = digest.process(bytes)
|
||||
|
||||
url = "Users/AuthenticateByName?format=json"
|
||||
|
||||
req = APIRequest(url)
|
||||
|
||||
' BrightScript will only return a POST body if you call post asynch
|
||||
|
@ -2,11 +2,10 @@ sub Main()
|
||||
m.port = CreateObject("roMessagePort")
|
||||
|
||||
if get_setting("server") = invalid then
|
||||
print "Moving to server select"
|
||||
ShowServerSelect()
|
||||
' TODO - be able to submit server info
|
||||
end if
|
||||
|
||||
print("WE MOVED ON")
|
||||
' if get_setting("active_user") = invalid then
|
||||
' screen = CreateObject("roSGScreen")
|
||||
' screen.setMessagePort(m.port)
|
||||
@ -26,13 +25,12 @@ sub Main()
|
||||
m.scene = screen.CreateScene(first_scene)
|
||||
screen.show()
|
||||
|
||||
libs = LibraryList().items
|
||||
librow = m.scene.findNode("LibrarySelect")
|
||||
libs = LibraryList()
|
||||
librow.libList = libs
|
||||
|
||||
'librow.GetRowListContent()
|
||||
|
||||
print 1 + "halt" ' Mixed types stops the debugger
|
||||
|
||||
while(true)
|
||||
msg = wait(0, m.port)
|
||||
msgType = type(msg)
|
||||
|
Loading…
x
Reference in New Issue
Block a user