765 lines
30 KiB
HTML
765 lines
30 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width">
|
|
<title>jellyfin-roku api docs Source: components/home/HomeRows.brs</title>
|
|
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/sunlight.dark.css">
|
|
|
|
<link type="text/css" rel="stylesheet" href="styles/site.darkly.css">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="navbar navbar-default navbar-fixed-top ">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="index.html">jellyfin-roku api docs</a>
|
|
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#topNavigation">
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
<span class="icon-bar"></span>
|
|
</button>
|
|
</div>
|
|
<div class="navbar-collapse collapse" id="topNavigation">
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li class="dropdown">
|
|
<a href="modules.list.html" class="dropdown-toggle" data-toggle="dropdown">Modules<b class="caret"></b></a>
|
|
<ul class="dropdown-menu ">
|
|
<li><a href="module-AlbumData.html">AlbumData</a></li><li><a href="module-AlbumGrid.html">AlbumGrid</a></li><li><a href="module-AlbumTrackList.html">AlbumTrackList</a></li><li><a href="module-AlbumView.html">AlbumView</a></li><li><a href="module-Alpha.html">Alpha</a></li><li><a href="module-ArtistView.html">ArtistView</a></li><li><a href="module-AudioPlayer.html">AudioPlayer</a></li><li><a href="module-AudioPlayerView.html">AudioPlayerView</a></li><li><a href="module-AudioTrackListItem.html">AudioTrackListItem</a></li><li><a href="module-ButtonGroupHoriz.html">ButtonGroupHoriz</a></li><li><a href="module-ChannelData.html">ChannelData</a></li><li><a href="module-CollectionData.html">CollectionData</a></li><li><a href="module-ConfigData.html">ConfigData</a></li><li><a href="module-ConfigItem.html">ConfigItem</a></li><li><a href="module-ConfigList.html">ConfigList</a></li><li><a href="module-ExtrasItem.html">ExtrasItem</a></li><li><a href="module-ExtrasRowList.html">ExtrasRowList</a></li><li><a href="module-FavoriteItemsTask.html">FavoriteItemsTask</a></li><li><a href="module-FolderData.html">FolderData</a></li><li><a href="module-GetFiltersTask.html">GetFiltersTask</a></li><li><a href="module-GetNextEpisodeTask.html">GetNextEpisodeTask</a></li><li><a href="module-GetPlaybackInfoTask.html">GetPlaybackInfoTask</a></li><li><a href="module-GetShuffleEpisodesTask.html">GetShuffleEpisodesTask</a></li><li><a href="module-GridItem.html">GridItem</a></li><li><a href="module-GridItemSmall.html">GridItemSmall</a></li><li><a href="module-Home.html">Home</a></li><li><a href="module-HomeData.html">HomeData</a></li><li><a href="module-HomeItem.html">HomeItem</a></li><li><a href="module-HomeRows.html">HomeRows</a></li><li><a href="module-IconButton.html">IconButton</a></li><li><a href="module-Image.html">Image</a></li><li><a href="module-ImageData.html">ImageData</a></li><li><a href="module-ItemGrid.html">ItemGrid</a></li><li><a href="module-ItemGridOptions.html">ItemGridOptions</a></li><li><a href="module-Items.html">Items</a></li><li><a href="module-JFButton.html">JFButton</a></li><li><a href="module-JFButtons.html">JFButtons</a></li><li><a href="module-JFGroup.html">JFGroup</a></li><li><a href="module-JFMessageDialog.html">JFMessageDialog</a></li><li><a href="module-JFOverhang.html">JFOverhang</a></li><li><a href="module-JFScene.html">JFScene</a></li><li><a href="module-JFScreen.html">JFScreen</a></li><li><a href="module-JFServer.html">JFServer</a></li><li><a href="module-JFVideo.html">JFVideo</a></li><li><a href="module-ListPoster.html">ListPoster</a></li><li><a href="module-LoadChannelsTask.html">LoadChannelsTask</a></li><li><a href="module-LoadItemsTask.html">LoadItemsTask</a></li><li><a href="module-LoadItemsTask2.html">LoadItemsTask2</a></li><li><a href="module-LoadPhotoTask.html">LoadPhotoTask</a></li><li><a href="module-LoadProgramDetailsTask.html">LoadProgramDetailsTask</a></li><li><a href="module-LoadScreenSaverTimeoutTask.html">LoadScreenSaverTimeoutTask</a></li><li><a href="module-LoadSheduleTask.html">LoadSheduleTask</a></li><li><a href="module-LoadVideoContentTask.html">LoadVideoContentTask</a></li><li><a href="module-LoginScene.html">LoginScene</a></li><li><a href="module-Main.html">Main</a></li><li><a href="module-MovieData.html">MovieData</a></li><li><a href="module-MovieDetails.html">MovieDetails</a></li><li><a href="module-MovieLibraryView.html">MovieLibraryView</a></li><li><a href="module-MovieOptions.html">MovieOptions</a></li><li><a href="module-MusicAlbumData.html">MusicAlbumData</a></li><li><a href="module-MusicAlbumSongListData.html">MusicAlbumSongListData</a></li><li><a href="module-MusicArtistData.html">MusicArtistData</a></li><li><a href="module-MusicArtistGridItem.html">MusicArtistGridItem</a></li><li><a href="module-MusicLibraryView.html">MusicLibraryView</a></li><li><a href="module-MusicSongData.html">MusicSongData</a></li><li><a href="module-OptionNode.html">OptionNode</a></li><li><a href="module-OptionsButton.html">OptionsButton</a></li><li><a href="module-OptionsData.html">OptionsData</a></li><li><a href="module-OptionsSlider.html">OptionsSlider</a></li><li><a href="module-OverviewDialog.html">OverviewDialog</a></li><li><a href="module-PersonData.html">PersonData</a></li><li><a href="module-PersonDetails.html">PersonDetails</a></li><li><a href="module-PhotoData.html">PhotoData</a></li><li><a href="module-PhotoDetails.html">PhotoDetails</a></li><li><a href="module-PlaybackDialog.html">PlaybackDialog</a></li><li><a href="module-PlayedCheckmark.html">PlayedCheckmark</a></li><li><a href="module-PlaylistData.html">PlaylistData</a></li><li><a href="module-PlaylistView.html">PlaylistView</a></li><li><a href="module-PlaystateTask.html">PlaystateTask</a></li><li><a href="module-ProgramDetails.html">ProgramDetails</a></li><li><a href="module-PublicUserData.html">PublicUserData</a></li><li><a href="module-QueueManager.html">QueueManager</a></li><li><a href="module-QuickConnect.html">QuickConnect</a></li><li><a href="module-QuickConnectDialog.html">QuickConnectDialog</a></li><li><a href="module-RadioDialog.html">RadioDialog</a></li><li><a href="module-RecordProgramTask.html">RecordProgramTask</a></li><li><a href="module-SceneManager.html">SceneManager</a></li><li><a href="module-ScheduleProgramData.html">ScheduleProgramData</a></li><li><a href="module-SearchBox.html">SearchBox</a></li><li><a href="module-SearchData.html">SearchData</a></li><li><a href="module-SearchResults.html">SearchResults</a></li><li><a href="module-SearchRow.html">SearchRow</a></li><li><a href="module-SearchTask.html">SearchTask</a></li><li><a href="module-SeriesData.html">SeriesData</a></li><li><a href="module-ServerDiscoveryTask.html">ServerDiscoveryTask</a></li><li><a href="module-SetServerScreen.html">SetServerScreen</a></li><li><a href="module-ShowScenes.html">ShowScenes</a></li><li><a href="module-SongItem.html">SongItem</a></li><li><a href="module-Spinner.html">Spinner</a></li><li><a href="module-StandardDialog.html">StandardDialog</a></li><li><a href="module-Subtitles.html">Subtitles</a></li><li><a href="module-TVEpisode.html">TVEpisode</a></li><li><a href="module-TVEpisodeData.html">TVEpisodeData</a></li><li><a href="module-TVEpisodeRow.html">TVEpisodeRow</a></li><li><a href="module-TVEpisodeRowWithOptions.html">TVEpisodeRowWithOptions</a></li><li><a href="module-TVEpisodes.html">TVEpisodes</a></li><li><a href="module-TVListDetails.html">TVListDetails</a></li><li><a href="module-TVListOptions.html">TVListOptions</a></li><li><a href="module-TVSeasonData.html">TVSeasonData</a></li><li><a href="module-TVSeasonRow.html">TVSeasonRow</a></li><li><a href="module-TVShowDescription.html">TVShowDescription</a></li><li><a href="module-TVShowDetails.html">TVShowDetails</a></li><li><a href="module-TextSizeTask.html">TextSizeTask</a></li><li><a href="module-UserData.html">UserData</a></li><li><a href="module-UserItem.html">UserItem</a></li><li><a href="module-UserLibrary.html">UserLibrary</a></li><li><a href="module-UserRow.html">UserRow</a></li><li><a href="module-UserSelect.html">UserSelect</a></li><li><a href="module-VideoData.html">VideoData</a></li><li><a href="module-VideoPlayer.html">VideoPlayer</a></li><li><a href="module-VideoPlayerView.html">VideoPlayerView</a></li><li><a href="module-VideoTrackListItem.html">VideoTrackListItem</a></li><li><a href="module-ViewCreator.html">ViewCreator</a></li><li><a href="module-WhatsNewDialog.html">WhatsNewDialog</a></li><li><a href="module-baserequest.html">baserequest</a></li><li><a href="module-captionTask.html">captionTask</a></li><li><a href="module-config.html">config</a></li><li><a href="module-deviceCapabilities.html">deviceCapabilities</a></li><li><a href="module-globals.html">globals</a></li><li><a href="module-migrations.html">migrations</a></li><li><a href="module-misc.html">misc</a></li><li><a href="module-quickplay.html">quickplay</a></li><li><a href="module-schedule.html">schedule</a></li><li><a href="module-section.html">section</a></li><li><a href="module-sectionScroller.html">sectionScroller</a></li><li><a href="module-settings.html">settings</a></li><li><a href="module-userauth.html">userauth</a></li>
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<div class="col-sm-3 col-md-3">
|
|
<form class="navbar-form" role="search">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" placeholder="Search" name="q" id="search-input">
|
|
<div class="input-group-btn">
|
|
<button class="btn btn-default" id="search-submit"><i class="glyphicon glyphicon-search"></i></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="container" id="toc-content">
|
|
<div class="row">
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div id="main">
|
|
|
|
|
|
<h1 class="page-title">Source: components/home/HomeRows.brs</h1>
|
|
|
|
<section>
|
|
<article>
|
|
<pre
|
|
class="sunlight-highlight-javascript linenums">import "pkg:/source/utils/misc.brs"
|
|
|
|
sub init()
|
|
m.top.itemComponentName = "HomeItem"
|
|
' how many rows are visible on the screen
|
|
m.top.numRows = 2
|
|
|
|
m.top.rowFocusAnimationStyle = "fixedFocusWrap"
|
|
m.top.vertFocusAnimationStyle = "fixedFocus"
|
|
|
|
m.top.showRowLabel = [true]
|
|
m.top.rowLabelOffset = [0, 20]
|
|
m.top.showRowCounter = [true]
|
|
|
|
m.homeSectionIndexes = {
|
|
count: 0
|
|
}
|
|
|
|
updateSize()
|
|
|
|
m.top.setfocus(true)
|
|
|
|
m.top.observeField("rowItemSelected", "itemSelected")
|
|
|
|
' Load the Libraries from API via task
|
|
m.LoadLibrariesTask = createObject("roSGNode", "LoadItemsTask")
|
|
m.LoadLibrariesTask.observeField("content", "onLibrariesLoaded")
|
|
|
|
' set up tesk nodes for other rows
|
|
m.LoadContinueWatchingTask = createObject("roSGNode", "LoadItemsTask")
|
|
m.LoadContinueWatchingTask.itemsToLoad = "continue"
|
|
|
|
m.LoadNextUpTask = createObject("roSGNode", "LoadItemsTask")
|
|
m.LoadNextUpTask.itemsToLoad = "nextUp"
|
|
|
|
m.LoadOnNowTask = createObject("roSGNode", "LoadItemsTask")
|
|
m.LoadOnNowTask.itemsToLoad = "onNow"
|
|
|
|
m.LoadFavoritesTask = createObject("roSGNode", "LoadItemsTask")
|
|
m.LoadFavoritesTask.itemsToLoad = "favorites"
|
|
end sub
|
|
|
|
sub loadLibraries()
|
|
m.LoadLibrariesTask.control = "RUN"
|
|
end sub
|
|
|
|
sub updateSize()
|
|
m.top.translation = [111, 180]
|
|
itemHeight = 330
|
|
|
|
'Set width of Rows to cut off at edge of Safe Zone
|
|
m.top.itemSize = [1703, itemHeight]
|
|
|
|
' spacing between rows
|
|
m.top.itemSpacing = [0, 105]
|
|
|
|
' spacing between items in a row
|
|
m.top.rowItemSpacing = [20, 0]
|
|
|
|
m.top.visible = true
|
|
end sub
|
|
|
|
sub onLibrariesLoaded()
|
|
' save data for other functions
|
|
m.libraryData = m.LoadLibrariesTask.content
|
|
m.LoadLibrariesTask.unobserveField("content")
|
|
m.LoadLibrariesTask.content = []
|
|
|
|
content = CreateObject("roSGNode", "ContentNode")
|
|
sizeArray = []
|
|
loadedSections = 0
|
|
|
|
' Add sections in order based on user settings
|
|
for i = 0 to 6
|
|
sectionName = LCase(m.global.session.user.settings["homesection" + i.toStr()])
|
|
sectionLoaded = addHomeSection(content, sizeArray, sectionName)
|
|
|
|
' Count how many sections with data are loaded
|
|
if sectionLoaded then loadedSections++
|
|
|
|
' If 2 sections with data are loaded or we're at the end of the web client section data, consider the home view loaded
|
|
if loadedSections = 2 or i = 6
|
|
if not m.global.app_loaded
|
|
m.top.signalBeacon("AppLaunchComplete") ' Roku Performance monitoring
|
|
m.global.app_loaded = true
|
|
end if
|
|
end if
|
|
end for
|
|
|
|
' Favorites isn't an option on Web settings, so we must manually add it for now
|
|
addHomeSection(content, sizeArray, "favorites")
|
|
|
|
m.top.rowItemSize = sizeArray
|
|
m.top.content = content
|
|
end sub
|
|
|
|
' Removes a home section from the home rows
|
|
sub removeHomeSection(sectionType as string)
|
|
sectionName = LCase(sectionType)
|
|
|
|
removedSectionIndex = m.homeSectionIndexes[sectionName]
|
|
|
|
if not isValid(removedSectionIndex) then return
|
|
|
|
for each section in m.homeSectionIndexes
|
|
if m.homeSectionIndexes[section] > removedSectionIndex
|
|
m.homeSectionIndexes[section]--
|
|
end if
|
|
end for
|
|
|
|
m.homeSectionIndexes.Delete(sectionName)
|
|
m.homeSectionIndexes.AddReplace("count", m.homeSectionIndexes.count - 1)
|
|
|
|
m.top.content.removeChildIndex(removedSectionIndex)
|
|
end sub
|
|
|
|
' Adds a new home section to the home rows.
|
|
' Returns a boolean indicating whether the section was handled.
|
|
function addHomeSection(content as dynamic, sizeArray as dynamic, sectionName as string) as boolean
|
|
' Poster size library items
|
|
if sectionName = "livetv"
|
|
createLiveTVRow(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
' Poster size library items
|
|
if sectionName = "smalllibrarytiles"
|
|
createLibraryRow(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
' Continue Watching items
|
|
if sectionName = "resume"
|
|
createContinueWatchingRow(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
' Next Up items
|
|
if sectionName = "nextup"
|
|
createNextUpRow(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
' Latest items in each library
|
|
if sectionName = "latestmedia"
|
|
createLatestInRows(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
' Favorite Items
|
|
if sectionName = "favorites"
|
|
createFavoritesRow(content, sizeArray)
|
|
return true
|
|
end if
|
|
|
|
return false
|
|
end function
|
|
|
|
' Create a row displaying the user's libraries
|
|
sub createLibraryRow(content as dynamic, sizeArray as dynamic)
|
|
' Ensure we have data
|
|
if not isValidAndNotEmpty(m.libraryData) then return
|
|
|
|
mediaRow = content.CreateChild("HomeRow")
|
|
mediaRow.title = tr("My Media")
|
|
|
|
m.homeSectionIndexes.AddReplace("library", m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
|
|
sizeArray.push([464, 331])
|
|
|
|
filteredMedia = filterNodeArray(m.libraryData, "id", m.global.session.user.configuration.MyMediaExcludes)
|
|
for each item in filteredMedia
|
|
mediaRow.appendChild(item)
|
|
end for
|
|
end sub
|
|
|
|
' Create a row displaying latest items in each of the user's libraries
|
|
sub createLatestInRows(content as dynamic, sizeArray as dynamic)
|
|
' Ensure we have data
|
|
if not isValidAndNotEmpty(m.libraryData) then return
|
|
|
|
' create a "Latest In" row for each library
|
|
filteredLatest = filterNodeArray(m.libraryData, "id", m.global.session.user.configuration.LatestItemsExcludes)
|
|
for each lib in filteredLatest
|
|
if lib.collectionType <> "boxsets" and lib.collectionType <> "livetv" and lib.json.CollectionType <> "Program"
|
|
latestInRow = content.CreateChild("HomeRow")
|
|
latestInRow.title = tr("Latest in") + " " + lib.name + " >"
|
|
|
|
m.homeSectionIndexes.AddReplace("latestin" + LCase(lib.name).Replace(" ", ""), m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
sizeArray.Push([464, 331])
|
|
|
|
loadLatest = createObject("roSGNode", "LoadItemsTask")
|
|
loadLatest.itemsToLoad = "latest"
|
|
loadLatest.itemId = lib.id
|
|
|
|
metadata = { "title": lib.name }
|
|
metadata.Append({ "contentType": lib.json.CollectionType })
|
|
loadLatest.metadata = metadata
|
|
|
|
loadLatest.observeField("content", "updateLatestItems")
|
|
loadLatest.control = "RUN"
|
|
end if
|
|
end for
|
|
end sub
|
|
|
|
' Create a row displaying the live tv now on section
|
|
sub createLiveTVRow(content as dynamic, sizeArray as dynamic)
|
|
contentRow = content.CreateChild("HomeRow")
|
|
contentRow.title = tr("On Now")
|
|
m.homeSectionIndexes.AddReplace("livetv", m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
sizeArray.push([464, 331])
|
|
|
|
m.LoadOnNowTask.observeField("content", "updateOnNowItems")
|
|
m.LoadOnNowTask.control = "RUN"
|
|
end sub
|
|
|
|
' Create a row displaying items the user can continue watching
|
|
sub createContinueWatchingRow(content as dynamic, sizeArray as dynamic)
|
|
continueWatchingRow = content.CreateChild("HomeRow")
|
|
continueWatchingRow.title = tr("Continue Watching")
|
|
m.homeSectionIndexes.AddReplace("resume", m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
sizeArray.push([464, 331])
|
|
|
|
' Load the Continue Watching Data
|
|
m.LoadContinueWatchingTask.observeField("content", "updateContinueWatchingItems")
|
|
m.LoadContinueWatchingTask.control = "RUN"
|
|
end sub
|
|
|
|
' Create a row displaying next episodes up to watch
|
|
sub createNextUpRow(content as dynamic, sizeArray as dynamic)
|
|
nextUpRow = content.CreateChild("HomeRow")
|
|
nextUpRow.title = tr("Next Up >")
|
|
m.homeSectionIndexes.AddReplace("nextup", m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
sizeArray.push([464, 331])
|
|
|
|
' Load the Next Up Data
|
|
m.LoadNextUpTask.observeField("content", "updateNextUpItems")
|
|
m.LoadNextUpTask.control = "RUN"
|
|
end sub
|
|
|
|
' Create a row displaying items from the user's favorites list
|
|
sub createFavoritesRow(content as dynamic, sizeArray as dynamic)
|
|
favoritesRow = content.CreateChild("HomeRow")
|
|
favoritesRow.title = tr("Favorites")
|
|
sizeArray.Push([464, 331])
|
|
|
|
m.homeSectionIndexes.AddReplace("favorites", m.homeSectionIndexes.count)
|
|
m.homeSectionIndexes.count++
|
|
|
|
' Load the Favorites Data
|
|
m.LoadFavoritesTask.observeField("content", "updateFavoritesItems")
|
|
m.LoadFavoritesTask.control = "RUN"
|
|
end sub
|
|
|
|
' Update home row data
|
|
sub updateHomeRows()
|
|
if m.global.playstateTask.state = "run"
|
|
m.global.playstateTask.observeField("state", "updateHomeRows")
|
|
return
|
|
end if
|
|
|
|
m.global.playstateTask.unobserveField("state")
|
|
|
|
' If resume section exists, reload row's data
|
|
if m.homeSectionIndexes.doesExist("resume")
|
|
m.LoadContinueWatchingTask.observeField("content", "updateContinueWatchingItems")
|
|
m.LoadContinueWatchingTask.control = "RUN"
|
|
end if
|
|
|
|
' If next up section exists, reload row's data
|
|
if m.homeSectionIndexes.doesExist("nextup")
|
|
m.LoadNextUpTask.observeField("content", "updateNextUpItems")
|
|
m.LoadNextUpTask.control = "RUN"
|
|
end if
|
|
|
|
' If favorites section exists, reload row's data
|
|
if m.homeSectionIndexes.doesExist("favorites")
|
|
m.LoadFavoritesTask.observeField("content", "updateFavoritesItems")
|
|
m.LoadFavoritesTask.control = "RUN"
|
|
end if
|
|
|
|
' If live tv's on now section exists, reload row's data
|
|
if m.homeSectionIndexes.doesExist("livetv")
|
|
m.LoadOnNowTask.observeField("content", "updateOnNowItems")
|
|
m.LoadOnNowTask.control = "RUN"
|
|
end if
|
|
|
|
' If latest in library section exists, reload row's data
|
|
hasLatestHomeSection = false
|
|
|
|
for each section in m.homeSectionIndexes
|
|
if LCase(Left(section, 6)) = "latest"
|
|
hasLatestHomeSection = true
|
|
exit for
|
|
end if
|
|
end for
|
|
|
|
if hasLatestHomeSection
|
|
updateLatestInRows()
|
|
end if
|
|
end sub
|
|
|
|
sub updateFavoritesItems()
|
|
itemData = m.LoadFavoritesTask.content
|
|
m.LoadFavoritesTask.unobserveField("content")
|
|
m.LoadFavoritesTask.content = []
|
|
|
|
if itemData = invalid then return
|
|
|
|
rowIndex = m.homeSectionIndexes.favorites
|
|
|
|
if itemData.count() < 1
|
|
removeHomeSection("favorites")
|
|
return
|
|
else
|
|
' remake row using the new data
|
|
row = CreateObject("roSGNode", "HomeRow")
|
|
row.title = tr("Favorites")
|
|
|
|
for each item in itemData
|
|
usePoster = true
|
|
|
|
if lcase(item.type) = "episode" or lcase(item.type) = "audio" or lcase(item.type) = "musicartist"
|
|
usePoster = false
|
|
end if
|
|
|
|
item.usePoster = usePoster
|
|
item.imageWidth = row.imageWidth
|
|
row.appendChild(item)
|
|
end for
|
|
|
|
' replace the old row
|
|
m.top.content.replaceChild(row, rowIndex)
|
|
|
|
end if
|
|
end sub
|
|
|
|
sub updateContinueWatchingItems()
|
|
itemData = m.LoadContinueWatchingTask.content
|
|
m.LoadContinueWatchingTask.unobserveField("content")
|
|
m.LoadContinueWatchingTask.content = []
|
|
|
|
if itemData = invalid then return
|
|
|
|
if itemData.count() < 1
|
|
removeHomeSection("resume")
|
|
return
|
|
end if
|
|
|
|
' remake row using the new data
|
|
row = CreateObject("roSGNode", "HomeRow")
|
|
row.title = tr("Continue Watching")
|
|
|
|
for each item in itemData
|
|
if isValid(item.json) and isValid(item.json.UserData) and isValid(item.json.UserData.PlayedPercentage)
|
|
item.PlayedPercentage = item.json.UserData.PlayedPercentage
|
|
end if
|
|
|
|
item.usePoster = row.usePoster
|
|
item.imageWidth = row.imageWidth
|
|
row.appendChild(item)
|
|
end for
|
|
|
|
' replace the old row
|
|
m.top.content.replaceChild(row, m.homeSectionIndexes.resume)
|
|
end sub
|
|
|
|
sub updateNextUpItems()
|
|
itemData = m.LoadNextUpTask.content
|
|
m.LoadNextUpTask.unobserveField("content")
|
|
m.LoadNextUpTask.content = []
|
|
|
|
if itemData = invalid then return
|
|
|
|
if itemData.count() < 1
|
|
removeHomeSection("nextup")
|
|
return
|
|
else
|
|
' remake row using the new data
|
|
row = CreateObject("roSGNode", "HomeRow")
|
|
row.title = tr("Next Up") + " >"
|
|
for each item in itemData
|
|
item.usePoster = row.usePoster
|
|
item.imageWidth = row.imageWidth
|
|
row.appendChild(item)
|
|
end for
|
|
|
|
' replace the old row
|
|
m.top.content.replaceChild(row, m.homeSectionIndexes.nextup)
|
|
end if
|
|
end sub
|
|
|
|
' Iterate over user's libraries and update data for each Latest In section
|
|
sub updateLatestInRows()
|
|
' Ensure we have data
|
|
if not isValidAndNotEmpty(m.libraryData) then return
|
|
|
|
' Load new data for each library
|
|
filteredLatest = filterNodeArray(m.libraryData, "id", m.global.session.user.configuration.LatestItemsExcludes)
|
|
for each lib in filteredLatest
|
|
if lib.collectionType <> "boxsets" and lib.collectionType <> "livetv" and lib.json.CollectionType <> "Program"
|
|
loadLatest = createObject("roSGNode", "LoadItemsTask")
|
|
loadLatest.itemsToLoad = "latest"
|
|
loadLatest.itemId = lib.id
|
|
|
|
metadata = { "title": lib.name }
|
|
metadata.Append({ "contentType": lib.json.CollectionType })
|
|
loadLatest.metadata = metadata
|
|
|
|
loadLatest.observeField("content", "updateLatestItems")
|
|
loadLatest.control = "RUN"
|
|
end if
|
|
end for
|
|
end sub
|
|
|
|
sub updateLatestItems(msg)
|
|
itemData = msg.GetData()
|
|
|
|
node = msg.getRoSGNode()
|
|
node.unobserveField("content")
|
|
node.content = []
|
|
|
|
if itemData = invalid then return
|
|
|
|
sectionName = "latestin" + LCase(node.metadata.title).Replace(" ", "")
|
|
|
|
rowIndex = m.homeSectionIndexes[sectionName]
|
|
|
|
if itemData.count() < 1
|
|
removeHomeSection(sectionName)
|
|
return
|
|
else
|
|
' remake row using new data
|
|
row = CreateObject("roSGNode", "HomeRow")
|
|
row.title = tr("Latest in") + " " + node.metadata.title + " >"
|
|
row.usePoster = true
|
|
' Handle specific types with different item widths
|
|
if node.metadata.contentType = "movies"
|
|
row.imageWidth = 180
|
|
itemSize = [188, 331]
|
|
else if node.metadata.contentType = "music"
|
|
row.imageWidth = 261
|
|
itemSize = [261, 331]
|
|
else
|
|
row.imageWidth = 464
|
|
itemSize = [464, 331]
|
|
end if
|
|
|
|
for each item in itemData
|
|
item.usePoster = row.usePoster
|
|
item.imageWidth = row.imageWidth
|
|
row.appendChild(item)
|
|
end for
|
|
|
|
' replace the old row
|
|
updateSizeArray(itemSize, rowIndex, "replace")
|
|
m.top.content.replaceChild(row, rowIndex)
|
|
end if
|
|
end sub
|
|
|
|
sub updateOnNowItems()
|
|
itemData = m.LoadOnNowTask.content
|
|
m.LoadOnNowTask.unobserveField("content")
|
|
m.LoadOnNowTask.content = []
|
|
|
|
if itemData = invalid then return
|
|
|
|
if itemData.count() < 1
|
|
removeHomeSection("livetv")
|
|
return
|
|
else
|
|
' remake row using the new data
|
|
row = CreateObject("roSGNode", "HomeRow")
|
|
row.title = tr("On Now")
|
|
for each item in itemData
|
|
item.usePoster = row.usePoster
|
|
item.imageWidth = row.imageWidth
|
|
row.appendChild(item)
|
|
end for
|
|
|
|
' replace the old row
|
|
m.top.content.replaceChild(row, m.homeSectionIndexes.livetv)
|
|
|
|
end if
|
|
end sub
|
|
|
|
sub updateSizeArray(rowItemSize, rowIndex = invalid, action = "insert")
|
|
sizeArray = m.top.rowItemSize
|
|
' append by default
|
|
if rowIndex = invalid
|
|
rowIndex = sizeArray.count()
|
|
end if
|
|
|
|
newSizeArray = []
|
|
for i = 0 to sizeArray.count()
|
|
if rowIndex = i
|
|
if action = "replace"
|
|
newSizeArray.Push(rowItemSize)
|
|
else if action = "insert"
|
|
newSizeArray.Push(rowItemSize)
|
|
if isValid(sizeArray[i])
|
|
newSizeArray.Push(sizeArray[i])
|
|
end if
|
|
end if
|
|
else if isValid(sizeArray[i])
|
|
newSizeArray.Push(sizeArray[i])
|
|
end if
|
|
end for
|
|
m.top.rowItemSize = newSizeArray
|
|
end sub
|
|
|
|
sub itemSelected()
|
|
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])
|
|
|
|
'Prevent the selected item event from double firing
|
|
m.top.selectedItem = invalid
|
|
end sub
|
|
|
|
function onKeyEvent(key as string, press as boolean) as boolean
|
|
if press
|
|
if key = "play"
|
|
print "play was pressed from homerow"
|
|
itemToPlay = m.top.content.getChild(m.top.rowItemFocused[0]).getChild(m.top.rowItemFocused[1])
|
|
if isValid(itemToPlay)
|
|
m.top.quickPlayNode = itemToPlay
|
|
end if
|
|
return true
|
|
else if key = "replay"
|
|
m.top.jumpToRowItem = [m.top.rowItemFocused[0], 0]
|
|
return true
|
|
end if
|
|
end if
|
|
return false
|
|
end function
|
|
|
|
function filterNodeArray(nodeArray as object, nodeKey as string, excludeArray as object) as object
|
|
if excludeArray.IsEmpty() then return nodeArray
|
|
|
|
newNodeArray = []
|
|
for each node in nodeArray
|
|
excludeThisNode = false
|
|
for each exclude in excludeArray
|
|
if node[nodeKey] = exclude
|
|
excludeThisNode = true
|
|
end if
|
|
end for
|
|
if excludeThisNode = false
|
|
newNodeArray.Push(node)
|
|
end if
|
|
end for
|
|
return newNodeArray
|
|
end function
|
|
</pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="modal fade" id="searchResults">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
<h4 class="modal-title">Search results</h4>
|
|
</div>
|
|
<div class="modal-body"></div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div><!-- /.modal-content -->
|
|
</div><!-- /.modal-dialog -->
|
|
</div>
|
|
|
|
|
|
<footer>
|
|
|
|
<span class="jsdoc-message">Source code: <a href="https://github.com/jellyfin/jellyfin-roku">https://github.com/jellyfin/jellyfin-roku</a></span><span class="jsdoc-message">Jellyfin Roku Development Forum: <a href="https://forum.jellyfin.org/f-roku-development">https://forum.jellyfin.org/f-roku-development</a></span>
|
|
|
|
|
|
<span class="jsdoc-message">
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a>
|
|
|
|
on Oct 31st 2023
|
|
|
|
using the <a href="https://github.com/docstrap/docstrap">DocStrap template</a>.
|
|
</span>
|
|
</footer>
|
|
|
|
<script src="scripts/docstrap.lib.js"></script>
|
|
<script src="scripts/toc.js"></script>
|
|
|
|
<script type="text/javascript" src="scripts/fulltext-search-ui.js"></script>
|
|
|
|
|
|
<script>
|
|
$( function () {
|
|
$( "[id*='$']" ).each( function () {
|
|
var $this = $( this );
|
|
|
|
$this.attr( "id", $this.attr( "id" ).replace( "$", "__" ) );
|
|
} );
|
|
|
|
$( ".tutorial-section pre, .readme-section pre, pre.prettyprint.source" ).each( function () {
|
|
var $this = $( this );
|
|
|
|
var example = $this.find( "code" );
|
|
exampleText = example.html();
|
|
var lang = /{@lang (.*?)}/.exec( exampleText );
|
|
if ( lang && lang[1] ) {
|
|
exampleText = exampleText.replace( lang[0], "" );
|
|
example.html( exampleText );
|
|
lang = lang[1];
|
|
} else {
|
|
var langClassMatch = example.parent()[0].className.match(/lang\-(\S+)/);
|
|
lang = langClassMatch ? langClassMatch[1] : "javascript";
|
|
}
|
|
|
|
if ( lang ) {
|
|
|
|
$this
|
|
.addClass( "sunlight-highlight-" + lang )
|
|
.addClass( "linenums" )
|
|
.html( example.html() );
|
|
|
|
}
|
|
} );
|
|
|
|
Sunlight.highlightAll( {
|
|
lineNumbers : true,
|
|
showMenu : true,
|
|
enableDoclinks : true
|
|
} );
|
|
|
|
$.catchAnchorLinks( {
|
|
navbarOffset: 10
|
|
} );
|
|
$( "#toc" ).toc( {
|
|
anchorName : function ( i, heading, prefix ) {
|
|
return $( heading ).attr( "id" ) || ( prefix + i );
|
|
},
|
|
selectors : "#toc-content h1,#toc-content h2,#toc-content h3,#toc-content h4",
|
|
showAndHide : false,
|
|
smoothScrolling: true
|
|
} );
|
|
|
|
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
|
|
$( '.dropdown-toggle' ).dropdown();
|
|
|
|
$( "table" ).each( function () {
|
|
var $this = $( this );
|
|
$this.addClass('table');
|
|
} );
|
|
|
|
} );
|
|
</script>
|
|
|
|
|
|
|
|
<!--Navigation and Symbol Display-->
|
|
|
|
|
|
<!--Google Analytics-->
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
SearcherDisplay.init();
|
|
});
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html>
|