diff --git a/components/ItemGrid/LoadItemsTask2.bs b/components/ItemGrid/LoadItemsTask2.bs index 67db3a9d4..60e8f783a 100644 --- a/components/ItemGrid/LoadItemsTask2.bs +++ b/components/ItemGrid/LoadItemsTask2.bs @@ -156,6 +156,40 @@ sub loadItems() params.limit = 100 ' If you have more than 100 in your Next Up queue, maybe go outside a bit more. params.append({ ImageTypeLimit: 1 }) params.append({ EnableImageTypes: "Primary,Backdrop,Banner,Thumb" }) + else if isStringEqual(m.top.ItemType, "mylist") + data = api.GetUserViews({ "userId": m.global.session.user.id }) + if not isChainValid(data, "Items") then return + + myListPlaylist = invalid + + for each item in data.LookupCI("items") + if isStringEqual(item.LookupCI("CollectionType"), "playlists") + myListPlaylist = api.items.Get({ + "userid": m.global.session.user.id, + "includeItemTypes": "Playlist", + "nameStartsWith": "[ROKU] My List", + "parentId": item.LookupCI("id") + }) + exit for + end if + end for + + if not isValid(myListPlaylist) or not isValidAndNotEmpty(myListPlaylist.items) then return + + playlistID = myListPlaylist.items[0].LookupCI("id") + + if not isValid(playlistID) then return + + url = "/items/" + + params.append( + { UserId: m.global.session.user.id, + ImageTypeLimit: 1, + EnableImageTypes: `${ImageType.PRIMARY}, ${ImageType.BACKDROP}, ${ImageType.THUMB}`, + Limit: 50, + EnableTotalRecordCount: false, + ParentId: playlistID + }) else url = Substitute("Users/{0}/Items/", m.global.session.user.id) end if diff --git a/components/Libraries/VisualLibraryScene.bs b/components/Libraries/VisualLibraryScene.bs index 3b903e928..27ad18270 100644 --- a/components/Libraries/VisualLibraryScene.bs +++ b/components/Libraries/VisualLibraryScene.bs @@ -180,8 +180,15 @@ sub loadInitialItems() ' Boxsets are sorted by Premiere Data by default if not isValidAndNotEmpty(m.sortField) - m.sortField = isStringEqual(getCollectionType(), ItemType.BOXSET) ? "PremiereDate,SortName" : "SortName" + if isStringEqual(getCollectionType(), ItemType.BOXSET) + m.sortField = "PremiereDate,SortName" + else if isStringEqual(getCollectionType(), ItemType.MYLIST) + m.sortField = "OrderAdded" + else + m.sortField = "SortName" + end if end if + if not isValidAndNotEmpty(m.filter) then m.filter = "All" if not isValidAndNotEmpty(m.filterOptions) then m.filterOptions = "{}" if not isValidAndNotEmpty(m.view) then m.view = "presentation" @@ -335,6 +342,10 @@ function setOptions() as object return setMovieOptions() end if + if isStringEqual(m.top.mediaType, ItemType.MYLIST) + return setMovieOptions() + end if + if isStringEqual(m.top.mediaType, ItemType.SERIES) return setSeriesOptions() end if @@ -392,6 +403,10 @@ function setMovieOptions() as object ] end if + if inArray([ItemType.MYLIST], getCollectionType()) + options.sort.unshift({ "Title": tr("Order Added"), "Name": "OrderAdded", "Track": { "description": tr("Order Added") } }) + end if + if isStringEqual(m.view, "genres") options.sort = [{ "Title": tr("TITLE"), "Name": "SortName", "Track": { "description": tr("TITLE") } }] options.filter = [{ "Title": tr("All"), "Name": "All" }] @@ -1178,7 +1193,13 @@ sub onViewChange() m.loadItemsTask.searchTerm = string.EMPTY m.filter = "All" m.filterOptions = {} - m.sortField = "SortName" + if isStringEqual(getCollectionType(), ItemType.BOXSET) + m.sortField = "PremiereDate,SortName" + else if isStringEqual(getCollectionType(), ItemType.MYLIST) + m.sortField = "OrderAdded" + else + m.sortField = "SortName" + end if m.sortAscending = true ' Reset view to defaults diff --git a/components/home/LoadItemsTask.bs b/components/home/LoadItemsTask.bs index 359301bda..8ec5e63d8 100644 --- a/components/home/LoadItemsTask.bs +++ b/components/home/LoadItemsTask.bs @@ -554,6 +554,21 @@ function loadMyList() as object results.push(tmp) end for + if myListData.Items.count() > 3 + tmp = CreateObject("roSGNode", "HomeData") + tmp.id = playlistID + tmp.type = ItemType.COLLECTIONFOLDER + tmp.usePoster = false + tmp.json = { + id: playlistID, + IsFolder: true, + Name: tr("View Full List"), + Type: ItemType.COLLECTIONFOLDER, + CollectionType: "mylist" + } + results.Unshift(tmp) + end if + return results end function diff --git a/source/MainEventHandlers.bs b/source/MainEventHandlers.bs index 224264137..63e111619 100644 --- a/source/MainEventHandlers.bs +++ b/source/MainEventHandlers.bs @@ -487,6 +487,12 @@ sub onLibrarySelection(selectedItem) return end if + if isStringEqual(selectedItem.collectionType, CollectionType.MYLIST) + group = CreateVisualLibraryScene(selectedItem, ITEMTYPE.MYLIST) + m.global.sceneManager.callFunc("pushScene", group) + return + end if + group = CreateItemGrid(selectedItem) m.global.sceneManager.callFunc("pushScene", group) end sub diff --git a/source/enums/CollectionType.bs b/source/enums/CollectionType.bs index 1be21a9f9..448f58255 100644 --- a/source/enums/CollectionType.bs +++ b/source/enums/CollectionType.bs @@ -6,6 +6,7 @@ enum CollectionType MOVIES = "movies" MUSIC = "music" MUSICVIDEOS = "musicvideos" + MYLIST = "mylist" NEXTUP = "nextup" TVSHOWS = "tvshows" end enum diff --git a/source/enums/ItemType.bs b/source/enums/ItemType.bs index 136398c2d..f1dbb4b1b 100644 --- a/source/enums/ItemType.bs +++ b/source/enums/ItemType.bs @@ -11,6 +11,7 @@ enum ItemType MUSICALBUM = "musicalbum" MUSICARTIST = "musicartist" MUSICVIDEO = "musicvideo" + MYLIST = "mylist" PERSON = "person" PHOTO = "photo" PHOTOALBUM = "photoalbum" diff --git a/source/static/whatsNew/1.1.4.json b/source/static/whatsNew/1.1.4.json index 0ac55495b..30dd36bcc 100644 --- a/source/static/whatsNew/1.1.4.json +++ b/source/static/whatsNew/1.1.4.json @@ -10,5 +10,13 @@ { "description": "Fix possible crash if music album doesn't have an image", "author": "1hitsong" + }, + { + "description": "Create My List - a personal queue", + "author": "1hitsong" + }, + { + "description": "Fix default sort after changing view of boxset items", + "author": "1hitsong" } ] \ No newline at end of file