mirror of
https://github.com/jellyfin/jellyfin-roku.git
synced 2024-11-23 06:09:41 +00:00
Added "Network/Genre" View Option to folders (#596)
This commit is contained in:
parent
57c2d50264
commit
1d03ad08ac
@ -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
|
||||
|
@ -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()) + ")"
|
||||
|
@ -34,6 +34,7 @@
|
||||
<Alpha id="AlphaMenu" />
|
||||
</children>
|
||||
<interface>
|
||||
<field id="HomeLibraryItem" type="string"/>
|
||||
<field id="parentItem" type="node" onChange="loadInitialItems" />
|
||||
<field id="selectedItem" type="node" alwaysNotify="true" />
|
||||
<field id="quickPlayNode" type="node" alwaysNotify="true" />
|
||||
@ -44,6 +45,7 @@
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/misc.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/deviceCapabilities.brs" />
|
||||
<script type="text/brightscript" uri="ItemGrid.brs" />
|
||||
</component>
|
||||
|
@ -36,7 +36,7 @@ sub optionsSet()
|
||||
if m.top.options.views <> invalid
|
||||
viewContent = CreateObject("roSGNode", "ContentNode")
|
||||
index = 0
|
||||
selectedViewIndex = 0
|
||||
selectedViewIndex = m.selectedViewIndex
|
||||
|
||||
for each view in m.top.options.views
|
||||
entry = viewContent.CreateChild("ContentNode")
|
||||
|
@ -22,9 +22,10 @@ sub loadItems()
|
||||
SortBy: sort_field,
|
||||
SortOrder: sort_order,
|
||||
recursive: m.top.recursive,
|
||||
Fields: "Overview"
|
||||
Fields: "Overview",
|
||||
StudioIds: m.top.studioIds,
|
||||
genreIds: m.top.genreIds
|
||||
}
|
||||
|
||||
' Handle special case when getting names starting with numeral
|
||||
if m.top.NameStartsWith <> ""
|
||||
if m.top.NameStartsWith = "#"
|
||||
@ -49,12 +50,17 @@ sub loadItems()
|
||||
if m.top.ItemType = "LiveTV"
|
||||
url = "LiveTv/Channels"
|
||||
params.append({ UserId: get_setting("active_user") })
|
||||
else if m.top.view = "Networks"
|
||||
url = "Studios"
|
||||
params.append({ UserId: get_setting("active_user") })
|
||||
else if m.top.view = "Genres"
|
||||
url = "Genres"
|
||||
params.append({ UserId: get_setting("active_user") })
|
||||
else
|
||||
url = Substitute("Users/{0}/Items/", get_setting("active_user"))
|
||||
end if
|
||||
resp = APIRequest(url, params)
|
||||
data = getJson(resp)
|
||||
|
||||
if data <> invalid
|
||||
|
||||
if data.TotalRecordCount <> invalid then m.top.totalRecordCount = data.TotalRecordCount
|
||||
@ -77,6 +83,12 @@ sub loadItems()
|
||||
tmp = CreateObject("roSGNode", "PhotoData")
|
||||
else if item.type = "PhotoAlbum"
|
||||
tmp = CreateObject("roSGNode", "FolderData")
|
||||
else if item.type = "Episode"
|
||||
tmp = CreateObject("roSGNode", "TVEpisode")
|
||||
else if item.Type = "Genre"
|
||||
tmp = CreateObject("roSGNode", "FolderData")
|
||||
else if item.Type = "Studio"
|
||||
tmp = CreateObject("roSGNode", "FolderData")
|
||||
else if item.Type = "MusicArtist" or item.Type = "MusicAlbum"
|
||||
tmp = CreateObject("roSGNode", "MusicArtistData")
|
||||
else if item.Type = "Audio"
|
||||
@ -84,8 +96,8 @@ sub loadItems()
|
||||
else
|
||||
print "[LoadItems] Unknown Type: " item.Type
|
||||
end if
|
||||
|
||||
if tmp <> invalid
|
||||
tmp.parentFolder = m.top.itemId
|
||||
tmp.json = item
|
||||
if item.UserData <> invalid and item.UserData.isFavorite <> invalid
|
||||
tmp.favorite = item.UserData.isFavorite
|
||||
@ -94,7 +106,5 @@ sub loadItems()
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
|
||||
m.top.content = results
|
||||
|
||||
end sub
|
||||
|
@ -12,7 +12,9 @@
|
||||
<field id="nameStartsWith" type="string" value="" />
|
||||
<field id="recursive" type="boolean" value="true" />
|
||||
<field id="filter" type="string" value="All" />
|
||||
|
||||
<field id="studioIds" type="string" value="" />
|
||||
<field id="genreIds" type="string" value="" />
|
||||
<field id="view" type="string" value="" />
|
||||
<!-- Total records available from server-->
|
||||
<field id="totalRecordCount" type="int" value="-1" />
|
||||
<field id="content" type="array" />
|
||||
|
@ -17,8 +17,13 @@ end sub
|
||||
sub setPoster()
|
||||
if m.top.image <> invalid
|
||||
m.top.posterURL = m.top.image.url
|
||||
else if m.top.json.Type = "Studio"
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Thumb", imgParams)
|
||||
else if m.top.json.ImageTags.Primary <> invalid
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295 }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
end if
|
||||
end sub
|
||||
|
||||
'TODO Set network Poster image
|
||||
|
@ -8,6 +8,7 @@
|
||||
<field id="SubTitle" type="string" value="" />
|
||||
<field id="iconUrl" type="string" value="" />
|
||||
<field id="Type" type="string" value="" />
|
||||
<field id="parentFolder" type="string" value="" />
|
||||
<field id="json" type="assocarray" onChange="setFields" />
|
||||
</interface>
|
||||
</component>
|
||||
|
21
components/data/TVEpisode.brs
Normal file
21
components/data/TVEpisode.brs
Normal file
@ -0,0 +1,21 @@
|
||||
sub setFields()
|
||||
json = m.top.json
|
||||
|
||||
m.top.id = json.id
|
||||
m.top.Title = json.name
|
||||
m.top.Description = json.overview
|
||||
m.top.favorite = json.UserData.isFavorite
|
||||
m.top.watched = json.UserData.played
|
||||
m.top.Type = json.Type
|
||||
|
||||
setPoster()
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
if m.top.image <> invalid
|
||||
m.top.posterURL = m.top.image.url
|
||||
else if m.top.json.ImageTags.Primary <> invalid
|
||||
imgParams = { "maxHeight": 440, "maxWidth": 295 }
|
||||
m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams)
|
||||
end if
|
||||
end sub
|
7
components/data/TVEpisode.xml
Normal file
7
components/data/TVEpisode.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<component name="TVEpisode" extends="JFContentItem">
|
||||
<script type="text/brightscript" uri="TVEpisode.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/Image.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/api/baserequest.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/config.brs" />
|
||||
</component>
|
@ -6,6 +6,7 @@ sub setFields()
|
||||
m.top.showID = datum.SeriesID
|
||||
m.top.seasonID = datum.SeasonID
|
||||
m.top.overview = datum.overview
|
||||
m.top.favorite = datum.UserData.isFavorite
|
||||
end sub
|
||||
|
||||
sub setPoster()
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 8.0 KiB After Width: | Height: | Size: 7.0 KiB |
@ -574,6 +574,17 @@
|
||||
<translation>There was an error authenticating via Quick Connect.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Networks</source>
|
||||
<translation>Networks</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Studios</source>
|
||||
<translation>Studios</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Shows</source>
|
||||
<translation>Shows</translation>
|
||||
</message>
|
||||
<source>Return to Top</source>
|
||||
<translation>Return to Top</translation>
|
||||
<extracomment>UI -> Media Grid -> Item Title in user setting screen.</extracomment>
|
||||
|
Loading…
Reference in New Issue
Block a user