Merge pull request #1949 from cewert/fix-home-item-crash

This commit is contained in:
Charles Ewert 2024-10-02 05:35:23 -07:00 committed by GitHub
commit ed6234937f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,12 +10,12 @@ sub init()
initItemPoster()
m.itemProgress = m.top.findNode("progress")
m.itemProgressBackground = m.top.findNode("progressBackground")
m.itemIcon = m.top.findNode("itemIcon")
initItemIcon()
initItemTextExtra()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.playedIndicator = m.top.findNode("playedIndicator")
initPlayedIndicator()
m.showProgressBarAnimation = m.top.findNode("showProgressBar")
m.showProgressBarField = m.top.findNode("showProgressBarField")
@ -50,6 +50,14 @@ sub initBackdrop()
m.backdrop = m.top.findNode("backdrop")
end sub
sub initItemIcon()
m.itemIcon = m.top.findNode("itemIcon")
end sub
sub initPlayedIndicator()
m.playedIndicator = m.top.findNode("playedIndicator")
end sub
sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
@ -63,6 +71,8 @@ sub itemContentChanged()
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()
if not isValid(m.backdrop) then initBackdrop()
if not isValid(m.itemIcon) then initItemIcon()
if not isValid(m.playedIndicator) then initPlayedIndicator()
m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
@ -87,6 +97,7 @@ sub itemContentChanged()
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
if isValid(m.unplayedCount) then m.unplayedCount.visible = true
if isValid(m.unplayedEpisodeCount)
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
end if
end if
@ -94,6 +105,7 @@ sub itemContentChanged()
end if
end if
end if
end if
' Format the Data based on the type of Home Data
if itemData.type = "CollectionFolder" or itemData.type = "UserView" or itemData.type = "Channel"