diff --git a/components/ItemGrid/ItemGrid.brs b/components/ItemGrid/ItemGrid.brs
index 2d299246..7f902434 100644
--- a/components/ItemGrid/ItemGrid.brs
+++ b/components/ItemGrid/ItemGrid.brs
@@ -12,6 +12,11 @@ sub init()
m.newBackdrop = m.top.findNode("backdropTransition")
m.emptyText = m.top.findNode("emptyText")
+ m.genreList = m.top.findNode("genrelist")
+ m.genreList.observeField("itemSelected", "onGenreItemSelected")
+ m.genreData = CreateObject("roSGNode", "ContentNode")
+ m.genreList.content = m.genreData
+
m.swapAnimation = m.top.findNode("backroundSwapAnimation")
m.swapAnimation.observeField("state", "swapDone")
@@ -74,6 +79,12 @@ sub init()
end if
end sub
+'
+'Genre Item Selected
+sub onGenreItemSelected()
+ m.top.selectedItem = m.genreList.content.getChild(m.genreList.rowItemSelected[0]).getChild(m.genreList.rowItemSelected[1])
+end sub
+
'
'Load initial set of Data
sub loadInitialItems()
@@ -287,6 +298,14 @@ sub setTvShowsOptions(options)
{ "Title": tr("Played"), "Name": "Played" },
{ "Title": tr("Unplayed"), "Name": "Unplayed" }
]
+
+ if isValid(m.view)
+ if LCase(m.options.view) = "genres" or LCase(m.view) = "genres"
+ options.sort = [{ "Title": tr("TITLE"), "Name": "SortName" }]
+ options.filter = []
+ end if
+ end if
+
end sub
' Set Live TV view, sort, and filter options
@@ -430,10 +449,32 @@ sub ItemDataLoaded(msg)
return
end if
+ if m.loadItemsTask.view = "Genres"
+ ' Reset genre list data
+ m.genreData.removeChildren(m.genreData.getChildren(-1, 0))
+
+ for each item in itemData
+ m.genreData.appendChild(item)
+ end for
+
+ m.itemGrid.opacity = "0"
+ m.genreList.opacity = "1"
+
+ m.itemGrid.setFocus(false)
+ m.genreList.setFocus(true)
+
+ m.loading = false
+ m.spinner.visible = false
+ return
+ end if
+
for each item in itemData
m.data.appendChild(item)
end for
+ m.itemGrid.opacity = "1"
+ m.genreList.opacity = "0"
+
'Update the stored counts
m.loadedItems = m.itemGrid.content.getChildCount()
m.loadedRows = m.loadedItems / m.itemGrid.numColumns
@@ -445,6 +486,7 @@ sub ItemDataLoaded(msg)
end if
m.itemGrid.setFocus(true)
+ m.genreList.setFocus(false)
m.spinner.visible = false
end sub
@@ -652,7 +694,10 @@ sub optionsClosed()
m.itemGrid.content = m.data
loadInitialItems()
end if
- m.itemGrid.setFocus(true)
+
+ m.itemGrid.setFocus(m.itemGrid.opacity = 1)
+ m.genreList.setFocus(m.genreList.opacity = 1)
+
if m.tvGuide <> invalid
m.tvGuide.lastFocus.setFocus(true)
end if
@@ -688,13 +733,19 @@ end sub
function onKeyEvent(key as string, press as boolean) as boolean
if not press then return false
- topGrp = m.top.findNode("itemGrid")
+
+ if m.itemGrid.opacity = 1
+ topGrp = m.itemGrid
+ else
+ topGrp = m.genreList
+ end if
searchGrp = m.top.findNode("voiceBox")
if key = "left" and searchGrp.isinFocusChain()
topGrp.setFocus(true)
searchGrp.setFocus(false)
end if
+
if key = "options"
if m.options.visible = true
m.options.visible = false
@@ -780,14 +831,16 @@ function onKeyEvent(key as string, press as boolean) as boolean
end function
sub updateTitle()
- if m.filter = "All"
- m.top.overhangTitle = m.top.parentItem.title
- else if m.filter = "Favorites"
+ m.top.overhangTitle = m.top.parentItem.title
+
+ if m.filter = "Favorites"
m.top.overhangTitle = m.top.parentItem.title + " " + tr("(Favorites)")
end if
+
if m.voiceBox.text <> ""
m.top.overhangTitle = m.top.parentItem.title + tr(" (Filtered by ") + m.loadItemsTask.searchTerm + ")"
end if
+
if m.top.alphaSelected <> ""
m.top.overhangTitle = m.top.parentItem.title + tr(" (Filtered by ") + m.loadItemsTask.nameStartsWith + ")"
end if
@@ -801,14 +854,18 @@ sub updateTitle()
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
+
+ if m.showItemCount and m.loadItemsTask.totalRecordCount > 0 and m.options.view <> "Genres" and m.view <> "Genres"
m.top.overhangTitle += " (" + tr("%1 of %2").Replace("%1", actInt.toStr()).Replace("%2", m.loadItemsTask.totalRecordCount.toStr()) + ")"
end if
diff --git a/components/ItemGrid/ItemGrid.xml b/components/ItemGrid/ItemGrid.xml
index ec528c44..9fcd213b 100644
--- a/components/ItemGrid/ItemGrid.xml
+++ b/components/ItemGrid/ItemGrid.xml
@@ -3,18 +3,8 @@
-
-
+
+
-
-
+
+
+
+
+
-
-
-
+
+
+
diff --git a/components/ItemGrid/LoadItemsTask2.brs b/components/ItemGrid/LoadItemsTask2.brs
index 15869651..9b777197 100644
--- a/components/ItemGrid/LoadItemsTask2.brs
+++ b/components/ItemGrid/LoadItemsTask2.brs
@@ -95,7 +95,7 @@ sub loadItems()
params.append({ UserId: get_setting("active_user") })
else if m.top.view = "Genres"
url = "Genres"
- params.append({ UserId: get_setting("active_user") })
+ params.append({ UserId: get_setting("active_user"), includeItemTypes: m.top.itemType })
else if m.top.ItemType = "MusicArtist"
url = "Artists"
params.append({
@@ -144,7 +144,7 @@ sub loadItems()
genreData = api_API().users.getitemsbyquery(get_setting("active_user"), {
SortBy: "Random",
SortOrder: "Ascending",
- IncludeItemTypes: "Movie",
+ IncludeItemTypes: m.top.itemType,
Recursive: true,
Fields: "PrimaryImageAspectRatio,MediaSourceCount,BasicSyncInfo",
ImageTypeLimit: 1,
@@ -159,26 +159,38 @@ sub loadItems()
' Add View All item to the start of the row
row = tmp.createChild("FolderData")
row.parentFolder = m.top.itemId
- genreMovieImage = api_API().items.getimageurl(item.id)
- row.title = item.name
+ row.title = tr("View All") + " " + item.name
+ item.name = tr("View All") + " " + item.name
row.json = item
- row.FHDPOSTERURL = genreMovieImage
- row.HDPOSTERURL = genreMovieImage
- row.SDPOSTERURL = genreMovieImage
row.type = "Folder"
+
+ if LCase(m.top.itemType) = "movie"
+ genreItemImage = api_API().items.getimageurl(item.id)
+ else
+ genreItemImage = invalid
+ row.posterURL = invalid
+ end if
+
+ row.FHDPOSTERURL = genreItemImage
+ row.HDPOSTERURL = genreItemImage
+ row.SDPOSTERURL = genreItemImage
end if
- for each genreMovie in genreData.Items
- row = tmp.createChild("MovieData")
+ for each genreItem in genreData.Items
+ if LCase(m.top.itemType) = "movie"
+ row = tmp.createChild("MovieData")
+ else
+ row = tmp.createChild("SeriesData")
+ end if
- genreMovieImage = api_API().items.getimageurl(genreMovie.id)
- row.title = genreMovie.name
- row.FHDPOSTERURL = genreMovieImage
- row.HDPOSTERURL = genreMovieImage
- row.SDPOSTERURL = genreMovieImage
- row.json = genreMovie
- row.id = genreMovie.id
- row.type = genreMovie.type
+ genreItemImage = api_API().items.getimageurl(genreItem.id)
+ row.title = genreItem.name
+ row.FHDPOSTERURL = genreItemImage
+ row.HDPOSTERURL = genreItemImage
+ row.SDPOSTERURL = genreItemImage
+ row.json = genreItem
+ row.id = genreItem.id
+ row.type = genreItem.type
end for
else if item.Type = "Studio"
diff --git a/components/ItemGrid/MovieLibraryView.brs b/components/ItemGrid/MovieLibraryView.brs
index 9db063fc..8595b4d9 100644
--- a/components/ItemGrid/MovieLibraryView.brs
+++ b/components/ItemGrid/MovieLibraryView.brs
@@ -252,7 +252,7 @@ sub setMoviesOptions(options)
]
if m.options.view = "Genres" or m.view = "Genres"
- options.sort = []
+ options.sort = [{ "Title": tr("TITLE"), "Name": "SortName" }]
options.filter = []
end if
diff --git a/locale/en_US/translations.ts b/locale/en_US/translations.ts
index e0cdab56..315a9200 100644
--- a/locale/en_US/translations.ts
+++ b/locale/en_US/translations.ts
@@ -997,6 +997,10 @@
Albums
+
+
+ View All
+
Disable Community Rating for Episodes
diff --git a/source/Main.brs b/source/Main.brs
index 7e279fe2..8c3b5831 100644
--- a/source/Main.brs
+++ b/source/Main.brs
@@ -124,7 +124,7 @@ sub Main (args as dynamic) as void
selectedItem = msg.getData()
m.selectedItemType = selectedItem.type
- '
+
if selectedItem.type = "CollectionFolder"
if selectedItem.collectionType = "movies"
group = CreateMovieLibraryView(selectedItem)
@@ -135,7 +135,13 @@ sub Main (args as dynamic) as void
end if
sceneManager.callFunc("pushScene", group)
else if selectedItem.type = "Folder" and selectedItem.json.type = "Genre"
- group = CreateMovieLibraryView(selectedItem)
+ ' User clicked on a genre folder
+ if selectedItem.collectionType = "movies"
+ group = CreateMovieLibraryView(selectedItem)
+ else
+ group = CreateItemGrid(selectedItem)
+ end if
+ sceneManager.callFunc("pushScene", group)
else if selectedItem.type = "Folder" and selectedItem.json.type = "MusicGenre"
group = CreateMusicLibraryView(selectedItem)
sceneManager.callFunc("pushScene", group)