source_utils_queueBackdropHelper.bs
' queueBackdropHelper.bs
' Utility function for updating backdrop based on current queue item
import "pkg:/source/utils/backdropUtils.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
' Generate backdrop URL from current item
backdropUrl = getBackdropUrl(currentItem.json, m.global.device.uiResolution)
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