Add more flexibility to movie item data
This commit is contained in:
parent
9005e5977e
commit
134ec2e347
|
@ -4,5 +4,7 @@
|
|||
<field id="title" type="string" />
|
||||
<field id="posterUrl" type="string" />
|
||||
<field id="movieID" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="full_data" type="associativearray" />
|
||||
</interface>
|
||||
</component>
|
||||
|
|
33
components/MovieItemMinimal.xml
Normal file
33
components/MovieItemMinimal.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="MovieItemMinimal" extends="Group">
|
||||
<children>
|
||||
<Label id="title"
|
||||
horizAlign="center"
|
||||
translation="[0,319]"
|
||||
font="font:MediumSystemFont"
|
||||
width="196"
|
||||
height="65" />
|
||||
</children>
|
||||
<interface>
|
||||
<field id="itemContent" type="node" onChange="itemContentChanged"/>
|
||||
</interface>
|
||||
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub Init()
|
||||
m.title = m.top.findNode("title")
|
||||
m.title.text = "Loading..."
|
||||
end sub
|
||||
|
||||
function itemContentChanged() as void
|
||||
' re-declare this because init doesnt re-run
|
||||
' when we come back from elsewhere
|
||||
m.title = m.top.findNode("title")
|
||||
|
||||
itemData = m.top.itemContent
|
||||
m.title.text = itemData.title
|
||||
end function
|
||||
]]>
|
||||
</script>
|
||||
|
||||
</component>
|
|
@ -32,10 +32,10 @@
|
|||
end sub
|
||||
|
||||
function setData()
|
||||
mvies = m.top.movieData
|
||||
movieData = m.top.movieData
|
||||
rowsize = m.top.rowSize
|
||||
|
||||
n = mvies.items.count()
|
||||
n = movieData.items.count()
|
||||
|
||||
' Test for no remainder
|
||||
if int(n/rowsize) = n/rowsize then
|
||||
|
@ -53,21 +53,23 @@
|
|||
return data
|
||||
end if
|
||||
|
||||
mvies = m.top.movieData
|
||||
movieData = m.top.movieData
|
||||
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 > mvies.items.count() then
|
||||
if index > movieData.items.count() then
|
||||
exit for
|
||||
end if
|
||||
datum = mvies.Items[index-1]
|
||||
datum = movieData.Items[index-1]
|
||||
item = row.CreateChild("MovieItemData")
|
||||
item.title = datum.name
|
||||
item.movieID = datum.id
|
||||
item.posterUrl = ImageURL(datum.id)
|
||||
item.description = datum.overview
|
||||
item.full_data = datum
|
||||
end for
|
||||
end for
|
||||
return data
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
' Functions for making requests to the API
|
||||
|
||||
function APIRequest(url as String, params={} as Object)
|
||||
req = createObject("roUrlTransfer")
|
||||
|
||||
if server_is_https() then
|
||||
req.setCertificatesFile("common:/certs/ca-bundle.crt")
|
||||
end if
|
||||
|
||||
full_url = get_base_url() + "/emby/" + url
|
||||
function buildURL(path as String, params={} as Object) as string
|
||||
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 + "?"
|
||||
|
||||
|
@ -25,6 +20,18 @@ function APIRequest(url as String, params={} as Object)
|
|||
full_url = full_url + param_array.join("&")
|
||||
end if
|
||||
|
||||
return full_url
|
||||
end function
|
||||
|
||||
function APIRequest(url as String, params={} as Object)
|
||||
req = createObject("roUrlTransfer")
|
||||
|
||||
if server_is_https() then
|
||||
req.setCertificatesFile("common:/certs/ca-bundle.crt")
|
||||
end if
|
||||
|
||||
full_url = buildURL(url, params)
|
||||
|
||||
req.setUrl(full_url)
|
||||
|
||||
req = authorize_request(req)
|
||||
|
@ -123,8 +130,7 @@ end function
|
|||
function ImageURL(id)
|
||||
url = Substitute("Items/{0}/Images/Primary", id)
|
||||
' ?maxHeight=384&maxWidth=256&tag=<tag>&quality=90"
|
||||
resp = APIRequest(url, {"maxHeight": "384", "maxWidth": "196", "quality": "90"})
|
||||
return resp.getUrl()
|
||||
return buildURL(url, {"maxHeight": "384", "maxWidth": "196", "quality": "90"})
|
||||
end function
|
||||
|
||||
' ServerBrowsing
|
||||
|
|
Loading…
Reference in New Issue
Block a user