Update API docs
This commit is contained in:
parent
6c759bca71
commit
c99ec70f5a
|
@ -803,20 +803,24 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
m.loadItemsTask.control = "stop"
|
||||
return true
|
||||
end if
|
||||
else if key = "play"
|
||||
else if key = "OK"
|
||||
markupGrid = m.top.findNode("itemGrid")
|
||||
itemToPlay = getItemFocused()
|
||||
|
||||
if itemToPlay <> invalid and itemToPlay.type = "Photo"
|
||||
' Spawn photo player task
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.itemsNode = markupGrid
|
||||
photoPlayer.itemIndex = markupGrid.itemFocused
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
return true
|
||||
end if
|
||||
else if key = "play"
|
||||
itemToPlay = getItemFocused()
|
||||
|
||||
if itemToPlay <> invalid
|
||||
m.top.quickPlayNode = itemToPlay
|
||||
return true
|
||||
else if itemToPlay <> invalid and itemToPlay.type = "Photo"
|
||||
' Spawn photo player task
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.items = markupGrid
|
||||
photoPlayer.itemIndex = markupGrid.itemFocused
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
return true
|
||||
end if
|
||||
else if key = "left" and topGrp.isinFocusChain()
|
||||
m.top.alphaActive = true
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -34,7 +34,9 @@ sub OnScreenShown()
|
|||
m.top.setFocus(true)
|
||||
end if
|
||||
|
||||
refresh()
|
||||
if not m.isFirstRun
|
||||
refresh()
|
||||
end if
|
||||
|
||||
' post the device profile the first time this screen is loaded
|
||||
if m.isFirstRun
|
||||
|
|
|
@ -39,6 +39,7 @@ sub itemContentChanged()
|
|||
m.itemText.maxWidth = itemData.imageWidth
|
||||
m.itemTextExtra.width = itemData.imageWidth
|
||||
m.itemTextExtra.visible = true
|
||||
m.itemTextExtra.text = ""
|
||||
|
||||
m.backdrop.width = itemData.imageWidth
|
||||
|
||||
|
@ -181,6 +182,7 @@ sub itemContentChanged()
|
|||
else
|
||||
m.itemPoster.uri = itemData.thumbnailURL
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
|
||||
|
@ -263,6 +265,38 @@ sub itemContentChanged()
|
|||
return
|
||||
end if
|
||||
|
||||
if itemData.type = "Photo"
|
||||
m.itemText.text = itemData.name
|
||||
m.itemPoster.uri = ImageURL(itemData.id)
|
||||
|
||||
' subtext
|
||||
if isValidAndNotEmpty(itemData.json)
|
||||
if isValid(itemData.json.ProductionYear)
|
||||
m.itemTextExtra.text = itemData.json.ProductionYear.ToStr().trim()
|
||||
end if
|
||||
if isValidAndNotEmpty(itemData.json.Album)
|
||||
if m.itemTextExtra.text = ""
|
||||
m.itemTextExtra.text = tr("Album") + ": " + itemData.json.Album.trim()
|
||||
else
|
||||
m.itemTextExtra.text = m.itemTextExtra.text + " - " + tr("Album") + ": " + itemData.json.Album.trim()
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
return
|
||||
end if
|
||||
|
||||
if itemData.type = "PhotoAlbum"
|
||||
m.itemText.text = itemData.name
|
||||
m.itemPoster.uri = ImageURL(itemData.id)
|
||||
|
||||
' subtext
|
||||
if isValid(itemData.json.ChildCount)
|
||||
m.itemTextExtra.text = itemData.json.ChildCount.ToStr().trim() + " items"
|
||||
end if
|
||||
|
||||
return
|
||||
end if
|
||||
|
||||
m.log.warn("Unhandled Home Item Type", itemData.type)
|
||||
end sub
|
||||
|
||||
|
|
|
@ -260,13 +260,6 @@ end sub
|
|||
|
||||
' Update home row data
|
||||
sub updateHomeRows()
|
||||
if m.global.playstateTask.state = "run"
|
||||
m.global.playstateTask.observeField("state", "updateHomeRows")
|
||||
return
|
||||
end if
|
||||
|
||||
m.global.playstateTask.unobserveField("state")
|
||||
|
||||
' If resume section exists, reload row's data
|
||||
if m.homeSectionIndexes.doesExist("resume")
|
||||
m.LoadContinueWatchingTask.observeField("content", "updateContinueWatchingItems")
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -24,8 +24,19 @@ end sub
|
|||
sub itemContentChanged()
|
||||
if isValidToContinue(m.top.itemIndex)
|
||||
m.LoadLibrariesTask = createObject("roSGNode", "LoadPhotoTask")
|
||||
itemContent = m.top.items.content.getChild(m.top.itemIndex)
|
||||
m.LoadLibrariesTask.itemContent = itemContent
|
||||
if isValid(m.top.itemsNode)
|
||||
if isValid(m.top.itemsNode.content)
|
||||
m.LoadLibrariesTask.itemNodeContent = m.top.itemsNode.content.getChild(m.top.itemIndex)
|
||||
else if isValidAndNotEmpty(m.top.itemsNode.id)
|
||||
m.LoadLibrariesTask.itemNodeContent = m.top.itemsNode
|
||||
end if
|
||||
else if isValid(m.top.itemsArray)
|
||||
itemContent = m.top.itemsArray[m.top.itemIndex]
|
||||
m.LoadLibrariesTask.itemArrayContent = itemContent
|
||||
else
|
||||
return
|
||||
end if
|
||||
|
||||
m.LoadLibrariesTask.observeField("results", "onPhotoLoaded")
|
||||
m.LoadLibrariesTask.control = "RUN"
|
||||
end if
|
||||
|
@ -55,8 +66,22 @@ sub nextSlide()
|
|||
m.slideshowTimer.control = "start"
|
||||
end if
|
||||
else if m.random = true
|
||||
index = rnd(m.top.items.content.getChildCount() - 1)
|
||||
if isValidToContinue(index)
|
||||
index = invalid
|
||||
|
||||
if isValid(m.top.itemsNode)
|
||||
if isValidAndNotEmpty(m.top.itemsNode.content)
|
||||
index = rnd(m.top.itemsNode.content.getChildCount() - 1)
|
||||
else
|
||||
' we're dealing with a single photo
|
||||
return
|
||||
end if
|
||||
else if isValid(m.top.itemsArray)
|
||||
if m.top.itemsArray.count() > 0
|
||||
index = rnd(m.top.itemsArray.count() - 1)
|
||||
end if
|
||||
end if
|
||||
|
||||
if isValid(index) and isValidToContinue(index)
|
||||
m.top.itemIndex = index
|
||||
m.slideshowTimer.control = "start"
|
||||
end if
|
||||
|
@ -68,6 +93,23 @@ sub statusUpdate()
|
|||
m.hideStatusAnimation.control = "start"
|
||||
end sub
|
||||
|
||||
' JFScreen hook.
|
||||
' Used to ensure tasks are stopped
|
||||
sub OnScreenHidden()
|
||||
m.slideshowTimer.control = "stop"
|
||||
m.statusTimer.control = "stop"
|
||||
end sub
|
||||
|
||||
' isSlideshow component field has changed
|
||||
sub isSlideshowChanged()
|
||||
m.slideshow = m.top.isSlideshow
|
||||
end sub
|
||||
|
||||
' isRandom component field has changed
|
||||
sub isRandomChanged()
|
||||
m.random = m.top.isRandom
|
||||
end sub
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
if not press then return false
|
||||
|
||||
|
@ -118,8 +160,16 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
|||
end function
|
||||
|
||||
function isValidToContinue(index as integer)
|
||||
if isValid(m.top.items) and isValid(m.top.items.content)
|
||||
if index >= 0 and index < m.top.items.content.getChildCount()
|
||||
if isValid(m.top.itemsNode)
|
||||
if isValidAndNotEmpty(m.top.itemsNode.content)
|
||||
if index >= 0 and index < m.top.itemsNode.content.getChildCount()
|
||||
return true
|
||||
end if
|
||||
else if isValidAndNotEmpty(m.top.itemsNode) and index = 0
|
||||
return true
|
||||
end if
|
||||
else if isValidAndNotEmpty(m.top.itemsArray)
|
||||
if index >= 0 and index < m.top.itemsArray.count()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
|
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
|
@ -203,6 +203,10 @@
|
|||
quickplay.tvChannel(itemNode)
|
||||
else if itemType = "program"
|
||||
quickplay.program(itemNode)
|
||||
else if itemType = "photo"
|
||||
quickplay.photo(itemNode)
|
||||
else if itemType = "photoalbum"
|
||||
quickplay.photoAlbum(itemNode)
|
||||
end if
|
||||
|
||||
m.global.queueManager.callFunc("playQueue")
|
||||
|
@ -295,7 +299,31 @@
|
|||
end if
|
||||
|
||||
else if selectedItemType = "Photo"
|
||||
' Nothing to do here, handled in ItemGrid
|
||||
' only handle selection if it's from the home screen
|
||||
if selectedItem.isSubType("HomeData")
|
||||
print "a photo was selected from the home screen"
|
||||
print "selectedItem=", selectedItem
|
||||
|
||||
quickplay.photo(selectedItem)
|
||||
end if
|
||||
else if selectedItemType = "PhotoAlbum"
|
||||
print "a photo album was selected"
|
||||
print "selectedItem=", selectedItem
|
||||
|
||||
' grab all photos inside photo album
|
||||
photoAlbumData = api.users.GetItemsByQuery(m.global.session.user.id, {
|
||||
"parentId": selectedItem.id,
|
||||
"includeItemTypes": "Photo",
|
||||
"Recursive": true
|
||||
})
|
||||
print "photoAlbumData=", photoAlbumData
|
||||
|
||||
if isValid(photoAlbumData) and isValidAndNotEmpty(photoAlbumData.items)
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.itemsArray = photoAlbumData.items
|
||||
photoPlayer.itemIndex = 0
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
end if
|
||||
else if selectedItemType = "MusicArtist"
|
||||
group = CreateArtistView(selectedItem.json)
|
||||
if not isValid(group)
|
||||
|
|
|
@ -311,6 +311,9 @@ function isValidAndNotEmpty(input as dynamic) as boolean
|
|||
if inputType = "string" or inputType = "rostring"
|
||||
trimmedInput = input.trim()
|
||||
return trimmedInput <> ""
|
||||
else if inputType = "rosgnode"
|
||||
inputId = input.id
|
||||
return inputId <> invalid
|
||||
else if countableTypes.doesExist(inputType)
|
||||
return input.count() > 0
|
||||
else
|
||||
|
|
|
@ -56,6 +56,39 @@ namespace quickplay
|
|||
m.global.queueManager.callFunc("push", itemNode)
|
||||
end sub
|
||||
|
||||
' A single photo.
|
||||
sub photo(itemNode as object)
|
||||
if not isValid(itemNode) or not isValid(itemNode.id) then return
|
||||
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.itemsNode = itemNode
|
||||
photoPlayer.itemIndex = 0
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
end sub
|
||||
|
||||
' A photo album.
|
||||
sub photoAlbum(itemNode as object)
|
||||
if not isValid(itemNode) or not isValid(itemNode.id) then return
|
||||
|
||||
' grab all photos inside photo album
|
||||
photoAlbumData = api.users.GetItemsByQuery(m.global.session.user.id, {
|
||||
"parentId": itemNode.id,
|
||||
"includeItemTypes": "Photo",
|
||||
"sortBy": "Random",
|
||||
"Recursive": true
|
||||
})
|
||||
print "photoAlbumData=", photoAlbumData
|
||||
|
||||
if isValid(photoAlbumData) and isValidAndNotEmpty(photoAlbumData.items)
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.isSlideshow = true
|
||||
photoPlayer.isRandom = false
|
||||
photoPlayer.itemsArray = photoAlbumData.items
|
||||
photoPlayer.itemIndex = 0
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
end if
|
||||
end sub
|
||||
|
||||
' A music album.
|
||||
' Play the entire album starting with track 1.
|
||||
sub album(itemNode as object)
|
||||
|
@ -372,6 +405,7 @@ namespace quickplay
|
|||
}
|
||||
' modify api query based on folder type
|
||||
folderType = Lcase(itemNode.json.type)
|
||||
print "folderType=", folderType
|
||||
if folderType = "studio"
|
||||
paramArray["studioIds"] = itemNode.id
|
||||
else if folderType = "genre"
|
||||
|
@ -383,6 +417,11 @@ namespace quickplay
|
|||
paramArray["genreIds"] = itemNode.id
|
||||
paramArray.delete("videoTypes")
|
||||
paramArray["includeItemTypes"] = "Audio"
|
||||
else if folderType = "photoalbum"
|
||||
paramArray["parentId"] = itemNode.id
|
||||
paramArray["includeItemTypes"] = "Photo"
|
||||
paramArray.delete("videoTypes")
|
||||
paramArray.delete("Recursive")
|
||||
else
|
||||
paramArray["parentId"] = itemNode.id
|
||||
end if
|
||||
|
@ -403,7 +442,16 @@ namespace quickplay
|
|||
quickplay.multipleSeries(folderData.items)
|
||||
end if
|
||||
else
|
||||
quickplay.pushToQueue(folderData.items, true)
|
||||
if folderType = "photoalbum"
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.isSlideshow = true
|
||||
photoPlayer.isRandom = false
|
||||
photoPlayer.itemsArray = folderData.items
|
||||
photoPlayer.itemIndex = 0
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
else
|
||||
quickplay.pushToQueue(folderData.items, true)
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end sub
|
||||
|
@ -517,7 +565,26 @@ namespace quickplay
|
|||
if isValid(data) and isValidAndNotEmpty(data.items)
|
||||
quickplay.pushToQueue(data.Items)
|
||||
end if
|
||||
' else if collectionType = "homevideos" ' also used for a "Photo" library
|
||||
else if collectionType = "homevideos"
|
||||
' Photo library - items can be type video, photo, or photoAlbum
|
||||
|
||||
' grab all photos inside library
|
||||
folderData = api.users.GetItemsByQuery(m.global.session.user.id, {
|
||||
"parentId": itemNode.id,
|
||||
"includeItemTypes": "Photo",
|
||||
"sortBy": "Random",
|
||||
"Recursive": true
|
||||
})
|
||||
print "folderData=", folderData
|
||||
|
||||
if isValid(folderData) and isValidAndNotEmpty(folderData.items)
|
||||
photoPlayer = CreateObject("roSgNode", "PhotoDetails")
|
||||
photoPlayer.isSlideshow = true
|
||||
photoPlayer.isRandom = false
|
||||
photoPlayer.itemsArray = folderData.items
|
||||
photoPlayer.itemIndex = 0
|
||||
m.global.sceneManager.callfunc("pushScene", photoPlayer)
|
||||
end if
|
||||
else
|
||||
print "Quick Play WARNING: Unknown collection type"
|
||||
end if
|
||||
|
|
Loading…
Reference in New Issue
Block a user