From 346cba23bc604b8359ea8cb9b6c4ca05a0a5b610 Mon Sep 17 00:00:00 2001 From: Nick Bisby Date: Fri, 1 Mar 2019 23:55:28 -0600 Subject: [PATCH] Actually populate LibraryList with real lib names --- components/ConfigurationList.xml | 144 ++++++++++++++++--------------- components/LibItem.xml | 7 +- components/ServerScene.xml | 5 +- components/mainlist.xml | 103 ++++++++++++++-------- source/JellyfinAPI.brs | 1 + source/Main.brs | 8 +- 6 files changed, 150 insertions(+), 118 deletions(-) diff --git a/components/ConfigurationList.xml b/components/ConfigurationList.xml index 13ae3372..715b5e5d 100644 --- a/components/ConfigurationList.xml +++ b/components/ConfigurationList.xml @@ -1,91 +1,99 @@ - - - - + 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 + ]]> + diff --git a/components/LibItem.xml b/components/LibItem.xml index dd861d9d..268d7504 100644 --- a/components/LibItem.xml +++ b/components/LibItem.xml @@ -1,10 +1,7 @@ - - - + @@ -13,14 +10,12 @@ + 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 + ]]> + diff --git a/source/JellyfinAPI.brs b/source/JellyfinAPI.brs index 4e00970b..d83ffb9d 100644 --- a/source/JellyfinAPI.brs +++ b/source/JellyfinAPI.brs @@ -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 diff --git a/source/Main.brs b/source/Main.brs index 16cfd13d..3fa7cba9 100644 --- a/source/Main.brs +++ b/source/Main.brs @@ -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)