Support BoxSets & Collections in new Item Grid
This commit is contained in:
parent
85301920bf
commit
93e64b6b39
|
@ -19,6 +19,10 @@ sub itemContentChanged()
|
|||
itemPoster.uri = itemData.PosterUrl
|
||||
m.itemText.text = itemData.Title
|
||||
return
|
||||
else if itemData.type = "Boxset" then
|
||||
itemPoster.uri = itemData.PosterUrl
|
||||
m.itemText.text = itemData.Title
|
||||
return
|
||||
end if
|
||||
|
||||
print "Unhandled Item Type: " + itemData.type
|
||||
|
|
|
@ -38,6 +38,8 @@ sub loadItems()
|
|||
tmp = CreateObject("roSGNode", "MovieData")
|
||||
else if item.Type = "Series" then
|
||||
tmp = CreateObject("roSGNode", "SeriesData")
|
||||
else if item.Type = "BoxSet" then
|
||||
tmp = CreateObject("roSGNode", "CollectionData")
|
||||
else
|
||||
print "Unknown Type: " item.Type
|
||||
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
sub setFields()
|
||||
datum = m.top.json
|
||||
json = m.top.json
|
||||
|
||||
m.top.id = datum.id
|
||||
m.top.title = datum.name
|
||||
m.top.overview = datum.overview
|
||||
m.top.id = json.id
|
||||
m.top.Title = json.name
|
||||
m.top.overview = json.overview
|
||||
m.top.Description = json.overview
|
||||
m.top.favorite = json.UserData.isFavorite
|
||||
m.top.watched = json.UserData.played
|
||||
m.top.Type = "Boxset"
|
||||
|
||||
m.top.favorite = datum.UserData.isFavorite
|
||||
m.top.watched = datum.UserData.played
|
||||
setPoster()
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
if m.top.image <> invalid
|
||||
m.top.posterURL = m.top.image.url
|
||||
else
|
||||
m.top.posterURL = ""
|
||||
|
||||
if m.top.json.ImageTags.Primary <> invalid then
|
||||
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag" : m.top.json.ImageTags.Primary }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
else if m.top.json.BackdropImageTags <> invalid then
|
||||
imgParams = { "maxHeight": 440, "Tag" : m.top.json.BackdropImageTags[0] }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
end if
|
||||
|
||||
' Add Backdrop Image
|
||||
if m.top.json.BackdropImageTags <> invalid then
|
||||
imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag" : m.top.json.BackdropImageTags[0] }
|
||||
m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams)
|
||||
end if
|
||||
|
||||
end if
|
||||
|
||||
end sub
|
|
@ -1,16 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="CollectionData" extends="ContentNode">
|
||||
<component name="CollectionData" extends="JFContentItem">
|
||||
<interface>
|
||||
<field id="title" type="string" />
|
||||
<field id="image" type="node" onChange="setPoster" />
|
||||
<field id="posterUrl" type="string" />
|
||||
<field id="collectionID" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="favorite" type="boolean" />
|
||||
<field id="watched" type="boolean" />
|
||||
<field id="type" type="string" value="boxsets" />
|
||||
<field id="overview" type="string" value="boxsets" />
|
||||
<field id="json" type="associativearray" onChange="setFields" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="CollectionData.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Image.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
</component>
|
|
@ -100,7 +100,7 @@ sub Main()
|
|||
group.visible = false
|
||||
|
||||
m.overhang.title = selectedItem.name
|
||||
group = CreateCollectionsList(selectedItem.Id)
|
||||
group = CreateCollectionsList(selectedItem)
|
||||
group.overhangTitle = selectedItem.name
|
||||
m.scene.appendChild(group)
|
||||
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "livetv"
|
||||
|
@ -112,6 +112,16 @@ sub Main()
|
|||
group = CreateChannelList(selectedItem.Id)
|
||||
group.overhangTitle = selectedItem.name
|
||||
m.scene.appendChild(group)
|
||||
else if selectedItem.type = "Boxset" then
|
||||
|
||||
group.lastFocus = group.focusedChild
|
||||
group.setFocus(false)
|
||||
group.visible = false
|
||||
|
||||
m.overhang.title = selectedItem.title
|
||||
group = CreateCollectionDetailList(selectedItem.Id)
|
||||
group.overhangTitle = selectedItem.title
|
||||
m.scene.appendChild(group)
|
||||
else if selectedItem.type = "Episode" then
|
||||
' play episode
|
||||
' todo: create an episode page to link here
|
||||
|
@ -175,17 +185,6 @@ sub Main()
|
|||
end if
|
||||
selectedItem = invalid
|
||||
end if
|
||||
else if isNodeEvent(msg, "collectionSelected")
|
||||
node = getMsgPicker(msg, "picker")
|
||||
|
||||
group.lastFocus = group.focusedChild
|
||||
group.setFocus(false)
|
||||
group.visible = false
|
||||
|
||||
m.overhang.title = node.title
|
||||
group = CreateCollectionDetailList(node.Id)
|
||||
group.overhangTitle = node.title
|
||||
m.scene.appendChild(group)
|
||||
else if isNodeEvent(msg, "movieSelected")
|
||||
' If you select a movie from ANYWHERE, follow this flow
|
||||
node = getMsgPicker(msg, "picker")
|
||||
|
|
|
@ -286,54 +286,14 @@ function CreateSeasonDetailsGroup(series, season)
|
|||
return group
|
||||
end function
|
||||
|
||||
function CreateCollectionsList(libraryId)
|
||||
' Load Collection Items
|
||||
group = CreateObject("roSGNode", "Collections")
|
||||
group.id = libraryId
|
||||
function CreateCollectionsList(libraryItem)
|
||||
|
||||
group.observeField("collectionSelected", m.port)
|
||||
group = CreateObject("roSGNode", "ItemGrid2")
|
||||
group.parentItem = libraryItem
|
||||
|
||||
group.observeField("selectedItem", m.port)
|
||||
|
||||
sidepanel = group.findNode("options")
|
||||
panel_options = [
|
||||
{"title": tr("Sort Field"),
|
||||
"base_title": tr("Sort Field"),
|
||||
"key": "movie_sort_field",
|
||||
"default": "SortName",
|
||||
"values": [
|
||||
{display: tr("Date Added"), value: "DateCreated"},
|
||||
{display: tr("Release Date"), value: "PremiereDate"},
|
||||
{display: tr("Name"), value: "SortName"}
|
||||
]},
|
||||
{"title": tr("Sort Order"),
|
||||
"base_title": tr("Sort Order"),
|
||||
"key": "movie_sort_order",
|
||||
"default": "Ascending",
|
||||
"values": [
|
||||
{display: tr("Descending"), value: "Descending"},
|
||||
{display: tr("Ascending"), value: "Ascending"}
|
||||
]}
|
||||
]
|
||||
new_options = []
|
||||
for each opt in panel_options
|
||||
o = CreateObject("roSGNode", "OptionsData")
|
||||
o.title = opt.title
|
||||
o.choices = opt.values
|
||||
o.base_title = opt.base_title
|
||||
o.config_key = opt.key
|
||||
o.value = get_user_setting(opt.key, opt.default)
|
||||
new_options.append([o])
|
||||
end for
|
||||
|
||||
sidepanel.options = new_options
|
||||
sidepanel.observeField("closeSidePanel", m.port)
|
||||
|
||||
p = CreatePaginator()
|
||||
group.appendChild(p)
|
||||
|
||||
group.pageNumber = 1
|
||||
p.currentPage = group.pageNumber
|
||||
|
||||
CollectionLister(group, m.page_size)
|
||||
|
||||
return group
|
||||
end function
|
||||
|
|
Loading…
Reference in New Issue
Block a user