add quick play support for music videos

This commit is contained in:
Charles Ewert 2023-09-23 10:52:29 -04:00
parent 5218002f10
commit 853419eb9b
3 changed files with 33 additions and 0 deletions

View File

@ -125,6 +125,11 @@ sub playQueue()
return
end if
if nextItemMediaType = "musicvideo"
CreateVideoPlayerView()
return
end if
if nextItemMediaType = "video"
CreateVideoPlayerView()
return

View File

@ -179,6 +179,8 @@ sub Main (args as dynamic) as void
quickplay.userView(itemNode)
else if itemType = "folder"
quickplay.folder(itemNode)
else if itemType = "musicvideo"
quickplay.musicVideo(itemNode)
end if
m.global.queueManager.callFunc("playQueue")

View File

@ -61,6 +61,13 @@ namespace quickplay
m.global.queueManager.callFunc("push", itemNode)
end sub
' A single music video file.
sub musicVideo(itemNode as object)
if not isValid(itemNode) or not isValid(itemNode.id) or not isValid(itemNode.json) then return
m.global.queueManager.callFunc("push", itemNode)
end sub
' A music album.
' Play the entire album starting with track 1.
sub album(itemNode as object)
@ -418,6 +425,25 @@ namespace quickplay
end for
m.global.queueManager.callFunc("toggleShuffle")
end if
else if collectionType = "musicvideos"
' get randomized list of videos inside
data = api.users.GetItemsByQuery(m.global.session.user.id, {
"parentId": itemNode.id,
"includeItemTypes": "MusicVideo",
"sortBy": "Random",
"Recursive": true,
"imageTypeLimit": 1,
"enableUserData": false,
"EnableTotalRecordCount": false
})
print "data=", data
if isValid(data) and isValidAndNotEmpty(data.items)
' add each item to the queue
pushToQueue(data.Items)
if data.items.count() > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
end if
' else if collectionType = "homevideos" ' also used for a "Photo" library
else
print "Quick Play WARNING: Unknown collection type"