Begin moving stuff around to better match API
This commit is contained in:
parent
fad323ac94
commit
77f822ae82
22
components/data/image.xml
Normal file
22
components/data/image.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="ImageData" extends="ContentNode">
|
||||
<interface>
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
<field id="imagetype" type="string" />
|
||||
<field id="size" type="string" />
|
||||
<field id="height" type="integer" />
|
||||
<field id="width" type="integer" />
|
||||
<field id="url" type="string" />
|
||||
</interface>
|
||||
<script type="text/brightscript">
|
||||
<![CDATA[
|
||||
sub setFields()
|
||||
json = m.top.json
|
||||
m.top.imagetype = json.imagetype
|
||||
m.top.size = json.size
|
||||
m.top.height = json.height
|
||||
m.top.width = json.width
|
||||
end sub
|
||||
]]>
|
||||
</script>
|
||||
</component>
|
9
source/api/Branding.brs
Normal file
9
source/api/Branding.brs
Normal file
|
@ -0,0 +1,9 @@
|
|||
function api_BrandingConfig()
|
||||
' Gets branding configuration
|
||||
' {
|
||||
' LoginDisclaimer: string
|
||||
' CustomCss: string
|
||||
' }
|
||||
resp = APIRequest("Branding/Configuration")
|
||||
return getJson(resp)
|
||||
end function
|
23
source/api/Image.brs
Normal file
23
source/api/Image.brs
Normal file
|
@ -0,0 +1,23 @@
|
|||
function ItemImages(id="" as String)
|
||||
' This seems to cause crazy core dumps
|
||||
resp = APIRequest(Substitute("Items/{0}/Images", id))
|
||||
data = getJson(resp)
|
||||
results = []
|
||||
for each item in data
|
||||
tmp = CreateObject("roSGNode", "ImageData")
|
||||
tmp.json = item
|
||||
tmp.url = ImageURL(id, tmp.imagetype)
|
||||
results.push(tmp)
|
||||
end for
|
||||
return results
|
||||
end function
|
||||
|
||||
|
||||
function ImageURL(id, version="Primary", params={})
|
||||
if params.count() = 0
|
||||
params = {"maxHeight": "384", "maxWidth": "196", "quality": "90"}
|
||||
end if
|
||||
url = Substitute("Items/{0}/Images/{1}", id, version)
|
||||
' ?maxHeight=384&maxWidth=256&tag=<tag>&quality=90"
|
||||
return buildURL(url, params)
|
||||
end function
|
|
@ -1,3 +1,30 @@
|
|||
function ItemsList(params={} as object)
|
||||
' Gets items based on a query.
|
||||
resp = APIRequest("Items", params)
|
||||
data = getJson(resp)
|
||||
' TODO - parse items
|
||||
return data
|
||||
end function
|
||||
|
||||
function UserItems(params={} as object)
|
||||
' Gets items based on a query
|
||||
resp = APIRequest(Substitute("Items/{0}/Items", get_setting("active_user")), params)
|
||||
data = getJson(resp)
|
||||
' TODO - parse items
|
||||
return data
|
||||
end function
|
||||
|
||||
function UserItemsResume(params={} as object)
|
||||
' Gets items based on a query
|
||||
resp = APIRequest(Substitute("Items/{0}/Items/Resume", get_setting("active_user")), params)
|
||||
data = getJson(resp)
|
||||
' TODO - parse items
|
||||
return data
|
||||
end function
|
||||
|
||||
|
||||
|
||||
|
||||
' List of available libraries
|
||||
function LibraryList()
|
||||
url = Substitute("Users/{0}/Views/", get_setting("active_user"))
|
19
source/api/Library.brs
Normal file
19
source/api/Library.brs
Normal file
|
@ -0,0 +1,19 @@
|
|||
function ItemCounts()
|
||||
' Gets counts of a library
|
||||
' Query:
|
||||
' UserId: Get counts from specific user's library
|
||||
' IsFavorite: Get counts of favorite items
|
||||
resp = APIRequest("Items/Counts", {})
|
||||
data = getJson(resp)
|
||||
return data
|
||||
end function
|
||||
|
||||
function LibraryMediaFolders()
|
||||
' Gets all user media folders
|
||||
' Query:
|
||||
' IsHidden: Filter by folders that are marked hidden, or not
|
||||
resp = APIRequest("Library/MediaFolders")
|
||||
data = getJson(resp)
|
||||
return data
|
||||
|
||||
end function
|
|
@ -12,7 +12,7 @@ function buildURL(path as String, params={} as Object) as string
|
|||
return ""
|
||||
end if
|
||||
|
||||
full_url = get_base_url() + "/emby/" + path
|
||||
full_url = get_base_url() + "/" + path
|
||||
if params.count() > 0
|
||||
full_url = full_url + "?"
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
function ImageURL(id, version="Primary", params={})
|
||||
if params.count() = 0
|
||||
params = {"maxHeight": "384", "maxWidth": "196", "quality": "90"}
|
||||
end if
|
||||
url = Substitute("Items/{0}/Images/{1}", id, version)
|
||||
' ?maxHeight=384&maxWidth=256&tag=<tag>&quality=90"
|
||||
return buildURL(url, params)
|
||||
end function
|
15
source/utils/globals.brs
Normal file
15
source/utils/globals.brs
Normal file
|
@ -0,0 +1,15 @@
|
|||
function initGlobal()
|
||||
if m.globals = invalid
|
||||
m.globals = CreateObject("roAssociativeArray")
|
||||
end if
|
||||
end function
|
||||
|
||||
function getGlobal(key="" as String) as Dynamic
|
||||
initGlobal()
|
||||
return m.globals[key]
|
||||
end function
|
||||
|
||||
function setGlobal(key="" as String, value=invalid as Dynamic)
|
||||
initGlobal()
|
||||
m.globals[key] = value
|
||||
end function
|
Loading…
Reference in New Issue
Block a user