diff --git a/components/ItemGrid/GridItem.brs b/components/ItemGrid/GridItem.brs index 4c4a6178..c89dd79c 100644 --- a/components/ItemGrid/GridItem.brs +++ b/components/ItemGrid/GridItem.brs @@ -37,26 +37,37 @@ sub itemContentChanged() if itemData.type = "Movie" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "Series" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "Boxset" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "TvChannel" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "Folder" m.itemPoster.uri = itemData.PosterUrl - m.itemIcon.uri = itemData.iconUrl + 'm.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title + m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode else if itemData.type = "Video" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title else if itemData.type = "Photo" m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl m.itemText.text = itemData.Title + else if itemData.type = "Episode" + m.itemPoster.uri = itemData.PosterUrl + m.itemIcon.uri = itemData.iconUrl + m.itemText.text = itemData.json.SeriesName + " - " + itemData.Title else if itemData.type = "MusicArtist" m.itemPoster.uri = itemData.PosterUrl m.itemText.text = itemData.Title diff --git a/components/ItemGrid/ItemGrid.brs b/components/ItemGrid/ItemGrid.brs index 7c8bd48e..5934cddd 100644 --- a/components/ItemGrid/ItemGrid.brs +++ b/components/ItemGrid/ItemGrid.brs @@ -42,9 +42,9 @@ sub init() 'set inital counts for overhang before content is loaded. m.loadItemsTask.totalRecordCount = 0 + m.spinner = m.top.findNode("spinner") m.spinner.visible = true - m.Alpha = m.top.findNode("AlphaMenu") m.AlphaSelected = m.top.findNode("AlphaSelected") @@ -55,7 +55,9 @@ end sub ' 'Load initial set of Data sub loadInitialItems() - + if m.top.parentItem.json.Type = "CollectionFolder" 'or m.top.parentItem.json.Type = "Folder" + m.top.HomeLibraryItem = m.top.parentItem.Id + end if if m.top.parentItem.backdropUrl <> invalid SetBackground(m.top.parentItem.backdropUrl) end if @@ -78,10 +80,10 @@ sub loadInitialItems() sortAscendingStr = get_user_setting("display." + m.top.parentItem.Id + ".sortAscending") m.filter = get_user_setting("display." + m.top.parentItem.Id + ".filter") else - m.view = invalid m.sortField = get_user_setting("display." + m.top.parentItem.Id + ".sortField") sortAscendingStr = get_user_setting("display." + m.top.parentItem.Id + ".sortAscending") m.filter = get_user_setting("display." + m.top.parentItem.Id + ".filter") + m.view = get_user_setting("display." + m.top.parentItem.Id + ".landing") end if if m.sortField = invalid then m.sortField = "SortName" @@ -92,28 +94,42 @@ sub loadInitialItems() else m.sortAscending = false end if + 'Set Stuido Id + if m.top.parentItem.json.type = "Studio" + m.loadItemsTask.studioIds = m.top.parentItem.Id + m.loadItemsTask.itemId = m.top.parentItem.parentFolder + m.loadItemsTask.genreIds = "" + 'set Genre Id + else if m.top.parentItem.json.type = "Genre" + m.loadItemsTask.genreIds = m.top.parentItem.Id + m.loadItemsTask.itemId = m.top.parentItem.parentFolder + m.loadItemsTask.studioIds = "" + else if (m.view = "Shows" or m.options.view = "Shows") or (m.view = "Movies" or m.options.view = "Movies") + m.loadItemsTask.studioIds = "" + m.loadItemsTask.genreIds = "" + end if + updateTitle() m.loadItemsTask.nameStartsWith = m.top.AlphaSelected m.emptyText.visible = false - - updateTitle() - - m.loadItemsTask.itemId = m.top.parentItem.Id m.loadItemsTask.sortField = m.sortField m.loadItemsTask.sortAscending = m.sortAscending m.loadItemsTask.filter = m.filter m.loadItemsTask.startIndex = 0 - + 'Load Item Types if m.top.parentItem.collectionType = "movies" m.loadItemsTask.itemType = "Movie" + m.loadItemsTask.itemId = m.top.parentItem.Id else if m.top.parentItem.collectionType = "tvshows" m.loadItemsTask.itemType = "Series" + m.loadItemsTask.itemId = m.top.parentItem.Id else if m.top.parentItem.collectionType = "music" ' Default Settings m.loadItemsTask.recursive = false m.itemGrid.itemSize = "[290, 290]" m.itemGrid.itemSpacing = "[ 0, 20]" m.loadItemsTask.itemType = "MusicArtist,MusicAlbum" + m.loadItemsTask.itemId = m.top.parentItem.Id m.view = get_user_setting("display.music.view") @@ -134,26 +150,51 @@ sub loadInitialItems() showTvGuide() end if + else if m.top.parentItem.collectionType = "CollectionFolder" or m.top.parentItem.type = "CollectionFolder" or m.top.parentItem.collectionType = "boxsets" or m.top.parentItem.Type = "Boxset" or m.top.parentItem.Type = "Folder" or m.top.parentItem.Type = "Channel" + ' Non-recursive, to not show subfolder contents m.loadItemsTask.recursive = false - else if m.top.parentItem.collectionType = "Channel" + m.loadItemsTask.itemId = m.top.parentItem.parentFolder + else if m.top.parentItem.Type = "Channel" m.top.imageDisplayMode = "scaleToFit" + else if m.top.parentItem.json.type = "Studio" + m.loadItemsTask.itemId = m.top.parentItem.parentFolder + m.loadItemsTask.itemType = "Series,Movie" + m.top.imageDisplayMode = "scaleToFit" + else if m.top.parentItem.json.type = "Genre" + m.loadItemsTask.itemType = "Series,Movie" + m.loadItemsTask.itemId = m.top.parentItem.parentFolder else print "[ItemGrid] Unknown Type: " m.top.parentItem end if + 'end if + if m.top.parentItem.type <> "Folder" and (m.options.view = "Networks" or m.view = "Networks" or m.options.view = "Studios" or m.view = "Studios") + m.loadItemsTask.view = "Networks" + m.top.imageDisplayMode = "scaleToFit" + else if m.top.parentItem.type <> "Folder" and (m.options.view = "Genres" or m.view = "Genres") + m.loadItemsTask.StudioIds = m.top.parentItem.Id + m.loadItemsTask.view = "Genres" + else if m.top.parentItem.type <> "Folder" and (m.options.view = "Shows" or m.view = "Shows") + m.loadItemsTask.studioIds = "" + m.loadItemsTask.view = "Shows" + else if m.top.parentItem.type <> "Folder" and (m.options.view = "Movies" or m.view = "Movies") + m.loadItemsTask.studioIds = "" + m.loadItemsTask.view = "Movies" + end if m.loadItemsTask.observeField("content", "ItemDataLoaded") + m.spinner.visible = true m.loadItemsTask.control = "RUN" - SetUpOptions() - end sub ' Set Movies view, sort, and filter options sub setMoviesOptions(options) options.views = [ - { "Title": tr("Movies"), "Name": "movies" }, + { "Title": tr("Movies"), "Name": "Movies" }, + { "Title": tr("Studios"), "Name": "Studios" }, + { "Title": tr("Genres"), "Name": "Genres" } ] options.sort = [ { "Title": tr("TITLE"), "Name": "SortName" }, @@ -189,7 +230,12 @@ end sub ' Set TV Show view, sort, and filter options sub setTvShowsOptions(options) - options.views = [{ "Title": tr("Shows"), "Name": "shows" }] + options.views = [ + { "Title": tr("Shows"), "Name": "Shows" }, + { "Title": tr("Networks"), "Name": "Networks" }, + { "Title": tr("Genres"), "Name": "Genres" } + + ] options.sort = [ { "Title": tr("TITLE"), "Name": "SortName" }, { "Title": tr("IMDB_RATING"), "Name": "CommunityRating" }, @@ -281,10 +327,10 @@ end function ' Data to display when options button selected sub SetUpOptions() - options = {} options.filter = [] options.favorite = [] + if getCollectionType() = "movies" setMoviesOptions(options) else if inStringArray(["boxsets", "Boxset"], getCollectionType()) @@ -297,6 +343,7 @@ sub SetUpOptions() setPhotoAlbumOptions(options) else if getCollectionType() = "music" setMusicOptions(options) + else setDefaultOptions(options) end if @@ -352,7 +399,6 @@ sub ItemDataLoaded(msg) m.loadedItems = m.itemGrid.content.getChildCount() m.loadedRows = m.loadedItems / m.itemGrid.numColumns m.Loading = false - 'If there are no items to display, show message if m.loadedItems = 0 m.emptyText.text = tr("NO_ITEMS").Replace("%1", m.top.parentItem.Type) @@ -396,7 +442,7 @@ sub onItemFocused() ' Set Background to item backdrop SetBackground(m.itemGrid.content.getChild(m.itemGrid.itemFocused).backdropUrl) - ' Load more data if focus is within last 3 rows, and there are more items to load + ' Load more data if focus is within last 5 rows, and there are more items to load if focusedRow >= m.loadedRows - 5 and m.loadeditems < m.loadItemsTask.totalRecordCount loadMoreData() end if @@ -433,9 +479,8 @@ end sub ' 'Load next set of items sub loadMoreData() - + m.spinner.visible = true if m.Loading = true then return - m.Loading = true m.loadItemsTask.startIndex = m.loadedItems m.loadItemsTask.observeField("content", "ItemDataLoaded") @@ -453,6 +498,7 @@ sub onItemAlphaSelected() m.loadedItems = 0 m.data = CreateObject("roSGNode", "ContentNode") m.itemGrid.content = m.data + m.spinner.visible = true loadInitialItems() end sub @@ -460,7 +506,6 @@ end sub ' 'Check if options updated and any reloading required sub optionsClosed() - if m.top.parentItem.collectionType = "livetv" and m.options.view <> m.view if m.options.view = "tvGuide" m.view = "tvGuide" @@ -503,6 +548,14 @@ sub optionsClosed() set_user_setting("display.music.view", m.view) reload = true end if + else + m.view = get_user_setting("display." + m.top.parentItem.Id + ".landing") + if m.options.view <> m.view + 'reload and store new view setting + m.view = m.options.view + set_user_setting("display." + m.top.parentItem.Id + ".landing", m.view) + reload = true + end if end if if m.options.sortField <> m.sortField or m.options.sortAscending <> m.sortAscending @@ -653,6 +706,15 @@ sub updateTitle() m.top.overhangTitle = m.top.parentItem.title + " " + tr("(Filtered)") end if + if m.options.view = "Networks" or m.view = "Networks" + m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Networks")) + end if + if m.options.view = "Studios" or m.view = "Studios" + m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Studios")) + end if + if m.options.view = "Genres" or m.view = "Genres" + m.top.overhangTitle = "%s (%s)".Format(m.top.parentItem.title, tr("Genres")) + end if actInt = m.itemGrid.itemFocused + 1 if m.showItemCount and m.loadItemsTask.totalRecordCount > 0 m.top.overhangTitle += " (" + tr("%1 of %2").Replace("%1", actInt.toStr()).Replace("%2", m.loadItemsTask.totalRecordCount.toStr()) + ")" diff --git a/components/ItemGrid/ItemGrid.xml b/components/ItemGrid/ItemGrid.xml index b8af2ca3..99a2dd19 100644 --- a/components/ItemGrid/ItemGrid.xml +++ b/components/ItemGrid/ItemGrid.xml @@ -34,6 +34,7 @@ + @@ -44,6 +45,7 @@