Merge pull request #230 from neilsb/tv-new-grid
Implement new ItemGrid for TV Shows
This commit is contained in:
commit
e0df9f938d
|
@ -15,6 +15,10 @@ sub itemContentChanged()
|
||||||
itemPoster.uri = itemData.PosterUrl
|
itemPoster.uri = itemData.PosterUrl
|
||||||
m.itemText.text = itemData.Title
|
m.itemText.text = itemData.Title
|
||||||
return
|
return
|
||||||
|
else if itemData.type = "Series" then
|
||||||
|
itemPoster.uri = itemData.PosterUrl
|
||||||
|
m.itemText.text = itemData.Title
|
||||||
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
print "Unhandled Item Type: " + itemData.type
|
print "Unhandled Item Type: " + itemData.type
|
||||||
|
|
|
@ -29,9 +29,16 @@ end sub
|
||||||
'
|
'
|
||||||
'Load initial set of Data
|
'Load initial set of Data
|
||||||
sub loadInitialItems()
|
sub loadInitialItems()
|
||||||
m.loadItemsTask.itemId = m.top.itemId
|
|
||||||
|
m.loadItemsTask.itemId = m.top.parentItem.Id
|
||||||
m.loadItemsTask.observeField("content", "ItemDataLoaded")
|
m.loadItemsTask.observeField("content", "ItemDataLoaded")
|
||||||
|
|
||||||
|
if m.top.parentItem.collectionType = "movies" then
|
||||||
m.loadItemsTask.itemType = "Movie"
|
m.loadItemsTask.itemType = "Movie"
|
||||||
|
else if m.top.parentItem.collectionType = "tvshows" then
|
||||||
|
m.loadItemsTask.itemType = "Series"
|
||||||
|
end if
|
||||||
|
|
||||||
m.loadItemsTask.control = "RUN"
|
m.loadItemsTask.control = "RUN"
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</Animation>
|
</Animation>
|
||||||
</children>
|
</children>
|
||||||
<interface>
|
<interface>
|
||||||
<field id="itemId" type="string" onChange="loadInitialItems" />
|
<field id="parentItem" type="node" onChange="loadInitialItems" />
|
||||||
<field id="selectedItem" type="node" alwaysNotify="true" />
|
<field id="selectedItem" type="node" alwaysNotify="true" />
|
||||||
</interface>
|
</interface>
|
||||||
<script type="text/brightscript" uri="ItemGrid2.brs" />
|
<script type="text/brightscript" uri="ItemGrid2.brs" />
|
||||||
|
|
|
@ -36,6 +36,8 @@ sub loadItems()
|
||||||
tmp = invalid
|
tmp = invalid
|
||||||
if item.Type = "Movie" then
|
if item.Type = "Movie" then
|
||||||
tmp = CreateObject("roSGNode", "MovieData")
|
tmp = CreateObject("roSGNode", "MovieData")
|
||||||
|
else if item.Type = "Series" then
|
||||||
|
tmp = CreateObject("roSGNode", "SeriesData")
|
||||||
else
|
else
|
||||||
print "Unknown Type: " item.Type
|
print "Unknown Type: " item.Type
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
sub setFields()
|
sub setFields()
|
||||||
|
|
||||||
' print "Setting Fields in MovieData - " m.top.json.name
|
|
||||||
json = m.top.json
|
json = m.top.json
|
||||||
|
|
||||||
m.top.id = json.id
|
m.top.id = json.id
|
||||||
|
|
|
@ -1,19 +1,49 @@
|
||||||
sub setFields()
|
sub setFields()
|
||||||
datum = m.top.json
|
json = m.top.json
|
||||||
m.top.id = datum.id
|
|
||||||
m.top.title = datum.name
|
m.top.id = json.id
|
||||||
m.top.overview = datum.overview
|
m.top.Title = json.name
|
||||||
|
m.top.Description = json.overview
|
||||||
|
m.top.favorite = json.UserData.isFavorite
|
||||||
|
m.top.watched = json.UserData.played
|
||||||
|
m.top.Type = "Series"
|
||||||
|
m.top.overview = json.overview
|
||||||
|
|
||||||
|
if json.ProductionYear <> invalid then
|
||||||
|
m.top.SubTitle = json.ProductionYear
|
||||||
|
end if
|
||||||
|
|
||||||
|
if json.OfficialRating <> invalid and json.OfficialRating <> "" then
|
||||||
|
m.top.Rating = json.OfficialRating
|
||||||
|
if m.top.SubTitle <> "" then
|
||||||
|
m.top.SubTitle = m.top.SubTitle + " - " + m.top.Rating
|
||||||
|
else
|
||||||
|
m.top.SubTitle = m.top.Rating
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
setPoster()
|
setPoster()
|
||||||
|
|
||||||
'm.top.seasons = TVSeasons(datum.id)
|
|
||||||
'm.top.nextup = TVNext(datum.id)
|
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub setPoster()
|
sub setPoster()
|
||||||
if m.top.image <> invalid
|
if m.top.image <> invalid
|
||||||
m.top.posterURL = m.top.image.url
|
m.top.posterURL = m.top.image.url
|
||||||
else
|
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 if
|
||||||
end sub
|
end sub
|
|
@ -1,15 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<component name="SeriesData" extends="ContentNode">
|
<component name="SeriesData" extends="JFContentItem">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="id" type="string" />
|
|
||||||
<field id="title" type="string" />
|
|
||||||
<field id="overview" type="string" />
|
<field id="overview" type="string" />
|
||||||
<field id="seasons" type="associativearray" />
|
<field id="seasons" type="associativearray" />
|
||||||
<field id="nextup" type="associativearray" />
|
<field id="nextup" type="associativearray" />
|
||||||
<field id="image" type="node" onChange="setPoster" />
|
<field id="image" type="node" onChange="setPoster" />
|
||||||
<field id="posterURL" type="string" />
|
|
||||||
<field id="json" type="associativearray" onChange="setFields" />
|
|
||||||
<function name="loadSeasons" />
|
<function name="loadSeasons" />
|
||||||
</interface>
|
</interface>
|
||||||
<script type="text/brightscript" uri="SeriesData.brs" />
|
<script type="text/brightscript" uri="SeriesData.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>
|
</component>
|
||||||
|
|
|
@ -82,7 +82,7 @@ sub Main()
|
||||||
group.setFocus(false)
|
group.setFocus(false)
|
||||||
group.visible = false
|
group.visible = false
|
||||||
m.overhang.title = selectedItem.name
|
m.overhang.title = selectedItem.name
|
||||||
group = CreateMovieListGroup(selectedItem.Id)
|
group = CreateMovieListGroup(selectedItem)
|
||||||
group.overhangTitle = selectedItem.name
|
group.overhangTitle = selectedItem.name
|
||||||
m.scene.appendChild(group)
|
m.scene.appendChild(group)
|
||||||
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "tvshows"
|
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "tvshows"
|
||||||
|
@ -91,7 +91,7 @@ sub Main()
|
||||||
group.visible = false
|
group.visible = false
|
||||||
|
|
||||||
m.overhang.title = selectedItem.name
|
m.overhang.title = selectedItem.name
|
||||||
group = CreateSeriesListGroup(selectedItem.Id)
|
group = CreateSeriesListGroup(selectedItem)
|
||||||
group.overhangTitle = selectedItem.name
|
group.overhangTitle = selectedItem.name
|
||||||
m.scene.appendChild(group)
|
m.scene.appendChild(group)
|
||||||
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "boxsets"
|
else if (selectedItem.type = "CollectionFolder" OR selectedItem.type = "UserView") AND selectedItem.collectionType = "boxsets"
|
||||||
|
|
|
@ -195,9 +195,9 @@ function CreateHomeGroup()
|
||||||
return group
|
return group
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function CreateMovieListGroup(libraryId)
|
function CreateMovieListGroup(libraryItem)
|
||||||
group = CreateObject("roSGNode", "ItemGrid2")
|
group = CreateObject("roSGNode", "ItemGrid2")
|
||||||
group.itemId = libraryId
|
group.parentItem = libraryItem
|
||||||
|
|
||||||
group.observeField("selectedItem", m.port)
|
group.observeField("selectedItem", m.port)
|
||||||
|
|
||||||
|
@ -252,21 +252,15 @@ function CreateMovieDetailsGroup(movie)
|
||||||
return group
|
return group
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function CreateSeriesListGroup(libraryId)
|
function CreateSeriesListGroup(libraryItem)
|
||||||
group = CreateObject("roSGNode", "TVShows")
|
|
||||||
group.id = libraryId
|
|
||||||
|
|
||||||
group.observeField("seriesSelected", m.port)
|
group = CreateObject("roSGNode", "ItemGrid2")
|
||||||
|
group.parentItem = libraryItem
|
||||||
|
|
||||||
|
group.observeField("selectedItem", m.port)
|
||||||
|
|
||||||
sidepanel = group.findNode("options")
|
sidepanel = group.findNode("options")
|
||||||
|
|
||||||
p = CreatePaginator()
|
|
||||||
group.appendChild(p)
|
|
||||||
|
|
||||||
group.pageNumber = 1
|
|
||||||
p.currentPage = group.pageNumber
|
|
||||||
SeriesLister(group, m.page_size)
|
|
||||||
|
|
||||||
return group
|
return group
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user