Whitespace and minor cleanup

This commit is contained in:
Nick Bisby 2019-03-04 23:18:01 -06:00
parent 0f15d6983f
commit 00bcb21ca1
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
10 changed files with 86 additions and 109 deletions

View File

@ -23,7 +23,7 @@
vertAlignment="center"
itemSpacings="20"
translation="[8,40]" >
<!-- above translation is itemspacings + item height / 2 -->
<!-- above translation is itemspacings + item height / 2 + border-->
<Label id="itemName" horizAlign="left" width="196" height="60" />
<Label id="itemValue" horizAlign="left" width="196" height="60" />
</LayoutGroup>
@ -36,30 +36,30 @@
</interface>
<script type="text/brightscript">
<![CDATA[
sub Init()
m.itemName = m.top.findNode("itemName")
m.itemValue = m.top.findNode("itemValue")
m.selectedBox = m.top.findNode("selectionOutline")
end sub
<![CDATA[
sub Init()
m.itemName = m.top.findNode("itemName")
m.itemValue = m.top.findNode("itemValue")
m.selectedBox = m.top.findNode("selectionOutline")
end sub
sub itemContentChanged() as void
itemData = m.top.itemContent
sub itemContentChanged() as void
itemData = m.top.itemContent
m.itemName.text = itemData.labelText
if itemData.valueText <> ""
m.itemValue.color = "#ffffff"
m.itemValue.text = itemData.valueText
else
m.itemValue.color = "#444444"
m.itemValue.text = "Enter a value..." ' TODO - get a placeholder
end if
end sub
m.itemName.text = itemData.labelText
if itemData.valueText <> ""
m.itemValue.color = "#ffffff"
m.itemValue.text = itemData.valueText
else
m.itemValue.color = "#444444"
m.itemValue.text = "Enter a value..." ' TODO - get a placeholder
end if
end sub
sub focusChanged() as void
m.selectedBox.opacity = m.top.focusPercent
end sub
]]>
sub focusChanged() as void
m.selectedBox.opacity = m.top.focusPercent
end sub
]]>
</script>
</component>

View File

@ -6,7 +6,6 @@
text="Submit"
translation="[0, 500]"
/>
</children>
<script type="text/brightscript" uri="pkg:/source/config.brs" />
<script type="text/brightscript">

View File

@ -8,18 +8,18 @@
</interface>
<script type="text/brightscript">
<![CDATA[
sub Init()
m.itemText = m.top.findNode("itemText")
m.itemText.text = "Loading..."
end sub
<![CDATA[
sub Init()
m.itemText = m.top.findNode("itemText")
m.itemText.text = "Loading..."
end sub
function itemContentChanged() as void
m.itemText = m.top.findNode("itemText")
itemData = m.top.itemContent
m.itemText.text = itemData.labelText
end function
]]>
function itemContentChanged() as void
m.itemText = m.top.findNode("itemText")
itemData = m.top.itemContent
m.itemText.text = itemData.labelText
end function
]]>
</script>
</component>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="LibraryRow" extends="RowList">
<interface>
<field id="rowSize" type="int" />
<field id="libList" type="associativearray" onChange="setData" />
<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" />
@ -28,8 +28,6 @@
m.top.showRowLabel = [false]
' m.top.observeField("itemSelected", "onItemSelected")
m.top.setfocus(true)
end sub
@ -74,17 +72,6 @@
end for
return data
end function
function onItemSelected()
x = m.top.rowItemSelected
target = m.top.content.getChild(x[0]).getChild(x[1])
print "Selected: " + target.libraryID + " " + target.libraryType
if target.libraryType = "movies" then
print
' TODO - emit a single back up to the very top port
end if
end function
]]>
</script>
</component>

View File

@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="Library" extends="Scene">
<children>
<LibraryRow
id="LibrarySelect"
visible="true"
translation="[150,150]"
/>
/>
</children>
</component>

View File

@ -13,21 +13,21 @@
</interface>
<script type="text/brightscript">
<![CDATA[
sub Init()
m.itemText = m.top.findNode("itemText")
m.itemText.text = "Loading..."
end sub
<![CDATA[
sub Init()
m.itemText = m.top.findNode("itemText")
m.itemText.text = "Loading..."
end sub
function itemContentChanged() as void
' re-declare this because init doesnt re-run
' when we come back from elsewhere
m.itemText = m.top.findNode("itemText")
function itemContentChanged() as void
' re-declare this because init doesnt re-run
' when we come back from elsewhere
m.itemText = m.top.findNode("itemText")
itemData = m.top.itemContent
m.itemText.text = itemData.labelText
end function
]]>
itemData = m.top.itemContent
m.itemText.text = itemData.labelText
end function
]]>
</script>
</component>

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="MovieRow" extends="RowList">
<interface>
<field id="rowSize" type="int" />
<field id="movieData" type="associativearray" onChange="setData" />
<field id="rowSize" type="int" />
<field id="movieData" type="associativearray" onChange="setData" />
</interface>
<script type="text/brightscript" uri="pkg:/source/config.brs" />
<script type="text/brightscript" uri="pkg:/source/JellyfinAPI.brs" />
@ -28,8 +28,6 @@
m.top.showRowLabel = [false]
'm.top.observeField("itemSelected", "onItemSelected")
m.top.setfocus(true)
end sub
@ -74,11 +72,6 @@
end for
return data
end function
function onItemSelected()
x = m.top.rowItemSelected
target = m.top.content.getChild(x[0]).getChild(x[1])
end function
]]>
</script>
</component>

View File

@ -5,7 +5,6 @@
id="MovieSelect"
visible="true"
translation="[150,150]"
/>
/>
</children>
</component>

View File

@ -11,21 +11,22 @@ function VideoPlayer(scene, id)
end function
function VideoContent(id) as object
content = createObject("RoSGNode", "ContentNode")
content = createObject("RoSGNode", "ContentNode")
meta = ItemMetaData(id)
content.title = meta.Name
meta = ItemMetaData(id)
content.title = meta.Name
server = get_setting("server")
content.url = Substitute("{0}/emby/Videos/{1}/stream.mp4", server, id)
content.url = content.url + "?Static=true"
' I'm not super happy that I'm basically re-implementing APIRequest
' but for a ContentNode instead of UrlTransfer
server = get_setting("server")
content.url = Substitute("{0}/emby/Videos/{1}/stream.mp4", server, id)
content.url = content.url + "?Static=true"
content = authorize_request(content)
content = authorize_request(content)
if server_is_https() then
content.setCertificatesFile("common:/certs/ca-bundle.crt")
end if
return content
if server_is_https() then
content.setCertificatesFile("common:/certs/ca-bundle.crt")
end if
return content
end function

View File

@ -3,53 +3,53 @@
' Generic registry accessors
function registry_read(key, section=invalid)
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
if reg.exists(key) then return reg.read(key)
return invalid
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
if reg.exists(key) then return reg.read(key)
return invalid
end function
function registry_write(key, value, section=invalid)
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
reg.write(key, value)
reg.flush()
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
reg.write(key, value)
reg.flush()
end function
function registry_delete(key, section=invalid)
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
reg.delete(key)
reg.flush()
if section = invalid then return invalid
reg = CreateObject("roRegistrySection", section)
reg.delete(key)
reg.flush()
end function
' "Jellyfin" registry accessors for the default global settings
function get_setting(key)
return registry_read(key, "Jellyfin")
return registry_read(key, "Jellyfin")
end function
function set_setting(key, value)
registry_write(key, value, "Jellyfin")
registry_write(key, value, "Jellyfin")
end function
function unset_setting(key)
registry_delete(key, "Jellyfin")
registry_delete(key, "Jellyfin")
end function
' User registry accessors for the currently active user
function get_user_setting(key)
if get_setting("active_user") = invalid then return invalid
return registry_read(key, get_setting("active_user"))
if get_setting("active_user") = invalid then return invalid
return registry_read(key, get_setting("active_user"))
end function
function set_user_setting(key, value)
if get_setting("active_user") = invalid then return invalid
registry_write(key, value, get_setting("active_user"))
if get_setting("active_user") = invalid then return invalid
registry_write(key, value, get_setting("active_user"))
end function
function unset_user_setting(key)
if get_setting("active_user") = invalid then return invalid
registry_delete(key, get_setting("active_user"))
if get_setting("active_user") = invalid then return invalid
registry_delete(key, get_setting("active_user"))
end function