Move movie details to use a MovieItem for data

This commit is contained in:
Nick Bisby 2019-03-10 00:12:09 -06:00
parent 62ece56456
commit 90b27998da
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
4 changed files with 16 additions and 10 deletions

View File

@ -1,7 +1,7 @@
sub itemContentChanged()
itemData = m.top.itemJson
itemData = m.top.itemContent.full_data
m.top.findNode("moviePoster").uri = ImageURL(itemData.id)
m.top.findNode("moviePoster").uri = m.top.itemContent.posterURL
' Handle all "As Is" fields
setFieldText("title", itemData.name)
@ -42,7 +42,7 @@ sub setFieldText(field as string, value)
end sub
function getRuntime() as Integer
itemData = m.top.itemJson
itemData = m.top.itemContent.full_data
' A tick is .1ms, so 1/10,000,000 for ticks to seconds,
' then 1/60 for seconds to minutess... 1/600,000,000
@ -50,7 +50,7 @@ function getRuntime() as Integer
end function
function getEndTime() as string
itemData = m.top.itemJson
itemData = m.top.itemContent.full_data
date = CreateObject("roDateTime")
duration_s = int(itemData.RunTimeTicks / 10000000.0)

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="MovieItemDetailScene" extends="Scene">
<children>
<LayoutGroup id="main_group" layoutDirection="horiz" translation="[50, 50]">
<LayoutGroup id="main_group" layoutDirection="horiz" >
<Poster id="moviePoster"
translation="[150,150]"
width="400" height="600" />
@ -31,7 +31,7 @@
</LayoutGroup>
</children>
<interface>
<field id="itemJson" type="associativearray" onChange="itemContentChanged" />
<field id="itemContent" type="node" onChange="itemContentChanged" />
</interface>
<script type="text/brightscript" uri="pkg:/source/config.brs" />
<script type="text/brightscript" uri="pkg:/source/JellyfinAPI.brs" />
@ -42,6 +42,8 @@
main = m.top.findNode("main_group")
dimensions = m.top.getScene().currentDesignResolution
main.translation=[50, 50]
m.top.findNode("buttons").setFocus(true)
end sub
]]>

View File

@ -1,7 +1,11 @@
' Functions for making requests to the API
function buildURL(path as String, params={} as Object) as string
req = createObject("roUrlTransfer") ' Just so we can use it for escape
' roURLTransfer can only be created on a Task Node, and somewhere something
' is trying to call it from a "regular" node
' So we'll just avoid using it for now
' Sucks that we can't use htmlescape any other way though
' req = createObject("roUrlTransfer") ' Just so we can use it for escape
full_url = get_base_url() + "/emby/" + path
if params.count() > 0
full_url = full_url + "?"
@ -15,8 +19,6 @@ function buildURL(path as String, params={} as Object) as string
'item = field.key + "=" + req.escape(str(field.value).trim())
item = field.key + "=" + str(field.value).trim()
else if field <> invalid
req = createObject("roUrlTransfer") ' Just so we can use it for escape
' TODO - find out why sometimes req is empty, despite doing this right here
'item = field.key + "=" + req.escape(field.value)
item = field.key + "=" + field.value
end if

View File

@ -152,7 +152,9 @@ sub ShowMovieDetails(movie_id)
themeScene(scene)
scene.itemJson = ItemMetaData(movie_id)
content = createObject("roSGNode", "MovieItemData")
content.full_data = ItemMetaData(movie_id)
scene.itemContent = content
buttons = scene.findNode("buttons")
buttons.observeField("buttonSelected", port)