Skip to content

Commit

Permalink
add support for studio and genre movie library view
Browse files Browse the repository at this point in the history
  • Loading branch information
cewert committed Sep 23, 2023
1 parent 06f69f3 commit c3d0e85
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
7 changes: 6 additions & 1 deletion components/ItemGrid/MovieLibraryView.brs
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,12 @@ end sub
'
'Returns Focused Item
function getItemFocused()
return m.itemGrid.content.getChild(m.itemGrid.itemFocused)
if m.itemGrid.isinFocusChain() and isValid(m.itemGrid.itemFocused)
return m.itemGrid.content.getChild(m.itemGrid.itemFocused)
else if m.genreList.isinFocusChain() and isValid(m.genreList.rowItemFocused)
return m.genreList.content.getChild(m.genreList.rowItemFocused[0]).getChild(m.genreList.rowItemFocused[1])
end if
return invalid
end function

'
Expand Down
2 changes: 2 additions & 0 deletions source/Main.brs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ sub Main (args as dynamic) as void
quickplay.playlist(itemNode)
else if itemType = "userview"
quickplay.userView(itemNode)
else if itemType = "folder"
quickplay.folder(itemNode)
end if

m.global.queueManager.callFunc("playQueue")
Expand Down
46 changes: 43 additions & 3 deletions source/utils/quickplay.bs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace quickplay
pushToQueue(artistSongs.items)

' don't show shuffle icon for 1 song
if artistSongs.items > 1
if artistSongs.items.count() > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
end if
Expand Down Expand Up @@ -265,6 +265,44 @@ namespace quickplay
end if
end sub

' Quick Play A folder.
' Shuffle play all items found
sub folder(itemNode as object)
if not isValid(itemNode) or not isValid(itemNode.id) then return
print "itemNode.json=", itemNode.json

paramArray = {
"includeItemTypes": ["Audio", "Episode", "Movie", "Video"],
"videoTypes": "VideoFile",
"sortBy": "Random",
"imageTypeLimit": 1,
"Recursive": true,
"enableUserData": false,
"EnableTotalRecordCount": false
}
' modify api query based on folder type
folderType = Lcase(itemNode.json.type)
if folderType = "studio"
paramArray["studioIds"] = itemNode.id
else if folderType = "genre"
paramArray["genreIds"] = itemNode.id
else
paramArray["parentId"] = itemNode.id
end if
' get folder items
folderData = api.users.GetItemsByQuery(m.global.session.user.id, paramArray)
print "folderData=", folderData

if isValid(folderData) and isValidAndNotEmpty(folderData.items)
pushToQueue(folderData.items)

' don't show shuffle icon for 1 item
if folderData.items.count() > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
end if
end sub

' Quick Play A CollectionFolder.
' Shuffle play the items inside
' with some differences based on collectionType.
Expand Down Expand Up @@ -308,7 +346,9 @@ namespace quickplay
print "songsData=", songsData
if isValid(songsData) and isValidAndNotEmpty(songsData.items)
pushToQueue(songsData.Items)
m.global.queueManager.callFunc("toggleShuffle")
if songsData.Items.count() > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
end if
else if collectionType = "boxsets"
' get list of all boxsets inside
Expand Down Expand Up @@ -415,7 +455,7 @@ namespace quickplay
m.global.queueManager.callFunc("push", item)
end for
' don't show shuffle icon for 1 item
if playlistItems.items > 1
if playlistItems.items.count() > 1
m.global.queueManager.callFunc("toggleShuffle")
end if
end if
Expand Down

0 comments on commit c3d0e85

Please sign in to comment.