source_utils_queueBackdropHelper.bs
' queueBackdropHelper.bs
' Utility function for updating backdrop based on current queue item
import "pkg:/source/utils/itemImageUrl.bs"
' updateQueueBackdrop: Updates backdrop based on current queue item
' Should be called whenever queue position changes or playback starts
'
' @returns {void}
sub updateQueueBackdrop()
queueManager = m.global.queueManager
currentItem = queueManager.callFunc("getCurrentItem")
if not isValid(currentItem)
' Clear backdrop if no item
m.global.sceneManager.callFunc("setBackgroundImage", "")
return
end if
' Build size from device resolution
uiResolution = m.global.device.uiResolution
backdropSize = { width: uiResolution[0], height: uiResolution[1] }
' Generate backdrop URL from current item typed fields
backdropUrl = getItemBackdropUrl(currentItem, backdropSize)
if backdropUrl = "" or not isValid(backdropUrl)
' Clear backdrop if none available
m.global.sceneManager.callFunc("setBackgroundImage", "")
else
' Update backdrop with animation
' setBackgroundImage handles duplicate URIs intelligently, so safe to call repeatedly
m.global.sceneManager.callFunc("setBackgroundImage", backdropUrl)
end if
end sub