2023-10-03 16:11:25 +00:00
|
|
|
import "pkg:/source/utils/misc.bs"
|
|
|
|
import "pkg:/source/utils/config.bs"
|
2023-05-03 21:21:04 +00:00
|
|
|
|
2022-09-24 00:16:52 +00:00
|
|
|
sub init()
|
|
|
|
m.itemPoster = m.top.findNode("itemPoster")
|
|
|
|
m.posterText = m.top.findNode("posterText")
|
2022-12-17 00:23:32 +00:00
|
|
|
m.title = m.top.findNode("title")
|
2022-09-24 00:16:52 +00:00
|
|
|
m.posterText.font.size = 30
|
2022-12-17 00:23:32 +00:00
|
|
|
m.title.font.size = 25
|
2022-09-24 00:16:52 +00:00
|
|
|
m.backdrop = m.top.findNode("backdrop")
|
2023-12-03 01:07:02 +00:00
|
|
|
m.playedIndicator = m.top.findNode("playedIndicator")
|
2022-09-24 00:16:52 +00:00
|
|
|
|
|
|
|
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
|
|
|
|
|
|
|
|
'Parent is MarkupGrid and it's parent is the ItemGrid
|
|
|
|
m.topParent = m.top.GetParent().GetParent()
|
|
|
|
|
2022-12-17 00:23:32 +00:00
|
|
|
m.title.visible = false
|
|
|
|
|
2022-09-24 00:16:52 +00:00
|
|
|
'Get the imageDisplayMode for these grid items
|
|
|
|
if m.topParent.imageDisplayMode <> invalid
|
|
|
|
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
|
|
|
|
end if
|
|
|
|
end sub
|
|
|
|
|
|
|
|
sub itemContentChanged()
|
|
|
|
m.backdrop.blendColor = "#101010"
|
|
|
|
|
2022-12-30 18:09:27 +00:00
|
|
|
m.title.visible = false
|
|
|
|
|
2022-12-17 00:23:32 +00:00
|
|
|
if isValid(m.topParent.showItemTitles)
|
2022-12-30 18:09:27 +00:00
|
|
|
if LCase(m.topParent.showItemTitles) = "showalways"
|
|
|
|
m.title.visible = true
|
|
|
|
end if
|
2022-12-17 00:23:32 +00:00
|
|
|
end if
|
|
|
|
|
2022-09-24 00:16:52 +00:00
|
|
|
itemData = m.top.itemContent
|
|
|
|
|
|
|
|
if not isValid(itemData) then return
|
|
|
|
|
2023-12-03 01:07:02 +00:00
|
|
|
if isValid(itemData.json.UserData.Played) and itemData.json.UserData.Played = true
|
|
|
|
m.playedIndicator.visible = true
|
|
|
|
end if
|
|
|
|
|
2022-09-24 00:16:52 +00:00
|
|
|
m.itemPoster.uri = itemData.PosterUrl
|
|
|
|
m.posterText.text = itemData.title
|
2022-12-17 00:23:32 +00:00
|
|
|
m.title.text = itemData.title
|
2022-09-24 00:16:52 +00:00
|
|
|
|
|
|
|
'If Poster not loaded, ensure "blue box" is shown until loaded
|
|
|
|
if m.itemPoster.loadStatus <> "ready"
|
|
|
|
m.backdrop.visible = true
|
|
|
|
m.posterText.visible = true
|
|
|
|
end if
|
|
|
|
end sub
|
|
|
|
|
2022-12-17 00:23:32 +00:00
|
|
|
sub focusChanged()
|
|
|
|
if m.top.itemHasFocus = true
|
|
|
|
m.title.repeatCount = -1
|
|
|
|
else
|
|
|
|
m.title.repeatCount = 0
|
|
|
|
end if
|
2022-12-30 18:09:27 +00:00
|
|
|
|
|
|
|
if isValid(m.topParent.showItemTitles)
|
|
|
|
if LCase(m.topParent.showItemTitles) = "showonhover"
|
|
|
|
m.title.visible = m.top.itemHasFocus
|
|
|
|
end if
|
|
|
|
end if
|
2022-12-17 00:23:32 +00:00
|
|
|
end sub
|
|
|
|
|
2022-09-24 00:16:52 +00:00
|
|
|
'Hide backdrop and text when poster loaded
|
|
|
|
sub onPosterLoadStatusChanged()
|
|
|
|
if m.itemPoster.loadStatus = "ready"
|
|
|
|
m.backdrop.visible = false
|
|
|
|
m.posterText.visible = false
|
|
|
|
end if
|
|
|
|
end sub
|