Update API docs
This commit is contained in:
parent
0c59c2a629
commit
aa9ad629d8
|
@ -127,6 +127,11 @@ sub playQueue()
|
|||
return
|
||||
end if
|
||||
|
||||
if nextItemMediaType = "audiobook"
|
||||
CreateAudioPlayerView()
|
||||
return
|
||||
end if
|
||||
|
||||
if nextItemMediaType = "musicvideo"
|
||||
CreateVideoPlayerView()
|
||||
return
|
||||
|
@ -256,6 +261,10 @@ sub setTopStartingPoint(positionTicks)
|
|||
m.queue[0].startingPoint = positionTicks
|
||||
end sub
|
||||
|
||||
' getItemType: Returns the media type of the passed item
|
||||
'
|
||||
' @param {dynamic} item - Item to evaluate
|
||||
' @return {string} indicating type of media item is
|
||||
function getItemType(item) as string
|
||||
if isValid(item) and isValid(item.json) and isValid(item.json.mediatype) and item.json.mediatype <> ""
|
||||
return LCase(item.json.mediatype)
|
||||
|
|
|
@ -11,6 +11,8 @@ sub init()
|
|||
m.lastRecordedPositionTimestamp = 0
|
||||
m.scrubTimestamp = -1
|
||||
|
||||
m.playlistTypeCount = m.global.queueManager.callFunc("getQueueUniqueTypes").count()
|
||||
|
||||
setupAudioNode()
|
||||
setupAnimationTasks()
|
||||
setupButtons()
|
||||
|
@ -18,8 +20,6 @@ sub init()
|
|||
setupDataTasks()
|
||||
setupScreenSaver()
|
||||
|
||||
m.playlistTypeCount = m.global.queueManager.callFunc("getQueueUniqueTypes").count()
|
||||
|
||||
m.buttonCount = m.buttons.getChildCount()
|
||||
m.seekPosition.translation = [720 - (m.seekPosition.width / 2), m.seekPosition.translation[1]]
|
||||
|
||||
|
@ -104,6 +104,20 @@ end sub
|
|||
sub setupButtons()
|
||||
m.buttons = m.top.findNode("buttons")
|
||||
m.top.observeField("selectedButtonIndex", "onButtonSelectedChange")
|
||||
|
||||
' If we're playing a mixed playlist, remove the shuffle and loop buttons
|
||||
if m.playlistTypeCount > 1
|
||||
shuffleButton = m.top.findNode("shuffle")
|
||||
m.buttons.removeChild(shuffleButton)
|
||||
|
||||
loopButton = m.top.findNode("loop")
|
||||
m.buttons.removeChild(loopButton)
|
||||
|
||||
m.previouslySelectedButtonIndex = 0
|
||||
m.top.selectedButtonIndex = 1
|
||||
return
|
||||
end if
|
||||
|
||||
m.previouslySelectedButtonIndex = 1
|
||||
m.top.selectedButtonIndex = 2
|
||||
end sub
|
||||
|
@ -286,8 +300,23 @@ function playAction() as boolean
|
|||
end function
|
||||
|
||||
function previousClicked() as boolean
|
||||
if m.playlistTypeCount > 1 then return false
|
||||
if m.global.queueManager.callFunc("getPosition") = 0 then return false
|
||||
currentQueuePosition = m.global.queueManager.callFunc("getPosition")
|
||||
|
||||
if currentQueuePosition = 0 then return false
|
||||
|
||||
if m.playlistTypeCount > 1
|
||||
previousItem = m.global.queueManager.callFunc("getItemByIndex", currentQueuePosition - 1)
|
||||
previousItemType = m.global.queueManager.callFunc("getItemType", previousItem)
|
||||
|
||||
if previousItemType <> "audio"
|
||||
m.global.audioPlayer.control = "stop"
|
||||
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveBack")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
exitScrubMode()
|
||||
|
||||
|
@ -341,7 +370,23 @@ sub setLoopButtonImage()
|
|||
end sub
|
||||
|
||||
function nextClicked() as boolean
|
||||
if m.playlistTypeCount > 1 then return false
|
||||
if m.playlistTypeCount > 1
|
||||
currentQueuePosition = m.global.queueManager.callFunc("getPosition")
|
||||
if currentQueuePosition < m.global.queueManager.callFunc("getCount") - 1
|
||||
|
||||
nextItem = m.global.queueManager.callFunc("getItemByIndex", currentQueuePosition + 1)
|
||||
nextItemType = m.global.queueManager.callFunc("getItemType", nextItem)
|
||||
|
||||
if nextItemType <> "audio"
|
||||
m.global.audioPlayer.control = "stop"
|
||||
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveForward")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
exitScrubMode()
|
||||
|
||||
|
@ -435,9 +480,6 @@ end sub
|
|||
|
||||
' If we have more and 1 song to play, fade in the next and previous controls
|
||||
sub loadButtons()
|
||||
' Don't show audio buttons if we have a mixed playlist
|
||||
if m.playlistTypeCount > 1 then return
|
||||
|
||||
if m.global.queueManager.callFunc("getCount") > 1
|
||||
m.shuffleIndicator.opacity = ".4"
|
||||
m.loopIndicator.opacity = ".4"
|
||||
|
|
|
@ -20,8 +20,8 @@ sub init()
|
|||
m.top.observeField("playbackState", "onPlaybackStateChanged")
|
||||
m.top.observeField("itemTitleText", "onItemTitleTextChanged")
|
||||
|
||||
m.defaultButtonIndex = 1
|
||||
m.focusedButtonIndex = 1
|
||||
m.defaultButtonIndex = 2
|
||||
m.focusedButtonIndex = 2
|
||||
|
||||
m.videoControls.buttonFocused = m.defaultButtonIndex
|
||||
m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1
|
||||
|
@ -77,7 +77,7 @@ sub resetFocusToDefaultButton()
|
|||
m.videoControls.setFocus(true)
|
||||
m.focusedButtonIndex = m.defaultButtonIndex
|
||||
m.videoControls.getChild(m.defaultButtonIndex).focus = true
|
||||
m.videoControls.buttonFocused = 1
|
||||
m.videoControls.buttonFocused = m.defaultButtonIndex
|
||||
m.optionControls.buttonFocused = m.optionControls.getChildCount() - 1
|
||||
end sub
|
||||
|
||||
|
|
|
@ -94,6 +94,35 @@ sub handleChapterSkipAction(action as string)
|
|||
end if
|
||||
end sub
|
||||
|
||||
' handleItemSkipAction: Handles user command to skip items
|
||||
'
|
||||
' @param {string} action - skip action to take
|
||||
sub handleItemSkipAction(action as string)
|
||||
if action = "itemnext"
|
||||
' If there is something next in the queue, play it
|
||||
if m.global.queueManager.callFunc("getPosition") < m.global.queueManager.callFunc("getCount") - 1
|
||||
m.top.control = "stop"
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveForward")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
|
||||
if action = "itemback"
|
||||
' If there is something previous in the queue, play it
|
||||
if m.global.queueManager.callFunc("getPosition") > 0
|
||||
m.top.control = "stop"
|
||||
m.global.sceneManager.callFunc("clearPreviousScene")
|
||||
m.global.queueManager.callFunc("moveBack")
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
end sub
|
||||
|
||||
' handleHideAction: Handles action to hide OSD menu
|
||||
'
|
||||
' @param {boolean} resume - controls whether or not to resume video playback when sub is called
|
||||
|
@ -222,6 +251,11 @@ sub onOSDAction()
|
|||
handleShowVideoInfoPopupAction()
|
||||
return
|
||||
end if
|
||||
|
||||
if action = "itemback" or action = "itemnext"
|
||||
handleItemSkipAction(action)
|
||||
return
|
||||
end if
|
||||
end sub
|
||||
|
||||
' Only setup caption items if captions are allowed
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user