Handle Mixed Media Folders

This commit is contained in:
Neil Burrows 2020-10-30 17:23:28 +00:00
parent ee25ed27ec
commit 45a785d391
13 changed files with 45 additions and 4 deletions

View File

@ -1,6 +1,7 @@
sub init()
m.posterMask = m.top.findNode("posterMask")
m.itemPoster = m.top.findNode("itemPoster")
m.itemIcon = m.top.findNode("itemIcon")
m.posterText = m.top.findNode("posterText")
m.itemText = m.top.findNode("itemText")
m.backdrop = m.top.findNode("backdrop")
@ -20,7 +21,7 @@ end sub
sub itemContentChanged()
' Set Randmom background colors from pallet
' Set Random background colors from pallet
posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
@ -40,6 +41,9 @@ sub itemContentChanged()
else if itemData.type = "TvChannel" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title
else if itemData.type = "Folder" then
m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
else if itemData.type = "Video" then
m.itemPoster.uri = itemData.PosterUrl
m.itemText.text = itemData.Title

View File

@ -4,6 +4,7 @@
<maskGroup id="posterMask" maskUri="pkg:/images/postermask.png" scaleRotateCenter="[145, 212.5]" scale="[0.85,0.85]" >
<Rectangle id="backdrop" width="290" height="425" />
<Poster id="itemPoster" width="290" height="425" loadDisplayMode="scaleToZoom" />
<Poster id="itemIcon" width="50" height="50" translation="[230,10]" />
<Label id="posterText" width="280" height="415" translation="[5,5]" horizAlign="center" vertAlign="center" ellipsizeOnBoundary="true" wrap="true" />
</maskGroup>
<ScrollingLabel id="itemText" horizAlign="center" font="font:SmallSystemFont" maxWidth="290" repeatCount="-1" visible="false" />

View File

@ -59,6 +59,9 @@ sub loadInitialItems()
'For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit"
else if m.top.parentItem.collectionType = "CollectionFolder" then
' Non-recursive, to not show subfolder contents
m.loadItemsTask.recursive = false
else if m.top.parentItem.collectionType = "Channel" then
m.top.imageDisplayMode = "scaleToFit"
else
@ -107,17 +110,20 @@ sub SetUpOptions()
{ "Title": tr("OFFICIAL_RATING"), "Name": "OfficialRating" },
{ "Title": tr("RELEASE_DATE"), "Name": "PremiereDate" },
]
options.filter = []
'Live TV
else if m.top.parentItem.collectionType = "livetv" then
options.views = [{"Title": tr("Live TV"), "Name": "livetv" }]
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" }
]
options.filter = []
else
options.views = [{"Title": tr("Default"), "Name": "default" }]
options.views = [{ "Title": tr("Default"), "Name": "default" }]
options.sort = [
{ "Title": tr("TITLE"), "Name": "SortName" }
]
options.filter = []
end if
for each o in options.sort

View File

@ -21,7 +21,7 @@ sub loadItems()
parentid: m.top.itemId,
SortBy: sort_field,
SortOrder: sort_order,
recursive: true,
recursive: m.top.recursive,
Fields: "Overview"
}
@ -59,6 +59,8 @@ sub loadItems()
tmp = CreateObject("roSGNode", "CollectionData")
else if item.Type = "TvChannel" then
tmp = CreateObject("roSGNode", "ChannelData")
else if item.Type = "Folder" then
tmp = CreateObject("roSGNode", "FolderData")
else if item.Type = "Video" then
tmp = CreateObject("roSGNode", "VideoData")
else

View File

@ -9,6 +9,7 @@
<field id="metadata" type="associativearray" />
<field id="sortField" type="string" value="SortName" />
<field id="sortAscending" type="boolean" value="true" />
<field id="recursive" type="boolean" value="true" />
<field id="filter" type="string" value="All" />
<!-- Total records available from server-->

View File

@ -0,0 +1,9 @@
sub setFields()
json = m.top.json
m.top.id = json.id
m.top.Title = json.name
m.top.Type = "Folder"
m.top.iconUrl = "pkg:/images/media_type_icons/folder_white.png"
end sub

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="FolderData" extends="JFContentItem">
<script type="text/brightscript" uri="FolderData.brs" />
</component>

View File

@ -6,6 +6,7 @@
<field id="posterUrl" type="string" />
<field id="backdropUrl" type="string" />
<field id="SubTitle" type="string" value="" />
<field id="iconUrl" type="string" value="" />
<field id="Type" type="string" value="" />
<field id="json" type="associativearray" onChange="setFields" />
</interface>

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

View File

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 478 B

View File

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 457 B

View File

@ -81,7 +81,7 @@ sub Main()
else if isNodeEvent(msg, "selectedItem")
' If you select a library from ANYWHERE, follow this flow
selectedItem = msg.getData()
if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "movies"
if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView" OR selectedItem.type = "Folder") AND ( selectedItem.collectionType = "movies" or selectedItem.collectionType = "CollectionFolder")
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
@ -126,6 +126,15 @@ sub Main()
group = CreateCollectionDetailList(selectedItem.Id)
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Folder"
group.lastFocus = group.focusedChild
group.setFocus(false)
group.visible = false
m.overhang.title = selectedItem.title
group = CreateCollectionsList(selectedItem)
group.overhangTitle = selectedItem.title
m.scene.appendChild(group)
else if selectedItem.type = "Episode" then
' play episode
' todo: create an episode page to link here

View File

@ -146,6 +146,10 @@ function ItemList(library_id = invalid as string, params = {})
tmp.image = PosterImage(item.id, imgParams)
tmp.json = item
results.push(tmp)
else if item.type = "Folder"
tmp = CreateObject("roSGNode", "FolderData")
tmp.json = item
results.push(tmp)
else
print "Items.brs::ItemList received unhandled type: " item.type
' Otherwise we just stick with the JSON