diff --git a/components/ItemGrid/MovieLibraryView.brs b/components/ItemGrid/MovieLibraryView.brs index 1dc46dbf7..5294f0c97 100644 --- a/components/ItemGrid/MovieLibraryView.brs +++ b/components/ItemGrid/MovieLibraryView.brs @@ -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 ' diff --git a/source/Main.brs b/source/Main.brs index c1d3e3c3f..02ce259bd 100644 --- a/source/Main.brs +++ b/source/Main.brs @@ -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") diff --git a/source/utils/quickplay.bs b/source/utils/quickplay.bs index e8528b964..44420b435 100644 --- a/source/utils/quickplay.bs +++ b/source/utils/quickplay.bs @@ -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 @@ -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. @@ -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 @@ -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