Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jellyfin-bot committed Oct 23, 2024
1 parent f394171 commit 440cc94
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 25 deletions.
21 changes: 18 additions & 3 deletions docs/api/components_extras_ExtrasRowList.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@
end sub

sub loadParts(data as object)
m.extrasGrp = m.top.getParent().findNode("extrasGrp")
m.top.parentId = data.id
m.people = data.People
m.LoadAdditionalPartsTask.itemId = m.top.parentId
m.LoadAdditionalPartsTask.control = "RUN"
end sub

sub loadPersonVideos(personId)
m.extrasGrp = m.top.getParent().findNode("extrasGrp")
m.personId = personId
m.LoadMoviesTask.itemId = m.personId
m.LoadMoviesTask.observeField("content", "onMoviesLoaded")
Expand Down Expand Up @@ -116,7 +118,7 @@
m.SpecialFeaturesTask.control = "RUN"
end sub

function onSpecialFeaturesLoaded()
sub onSpecialFeaturesLoaded()
data = m.SpecialFeaturesTask.content
m.SpecialFeaturesTask.unobserveField("content")
if data <> invalid and data.count() > 0
Expand All @@ -134,8 +136,8 @@
addRowSize([462, 372])
end if

return m.top.content
end function
showOrHideMe()
end sub

sub onMoviesLoaded()
data = m.LoadMoviesTask.content
Expand Down Expand Up @@ -181,6 +183,8 @@
m.top.content.appendChild(row)
end if
m.top.visible = true

showOrHideMe()
end sub

function buildRow(rowTitle as string, items, imgWdth = 0)
Expand Down Expand Up @@ -220,6 +224,17 @@
m.top.rowItemSize = newSizeArray
end sub

' don't show popup panel if there is nothing to show
sub showOrHideMe()
if isValid(m.top.content)
if m.top.content.getChildCount() = 0
m.extrasGrp.visible = false
else
m.extrasGrp.visible = true
end if
end if
end sub

sub onRowItemSelected()
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])
end sub
Expand Down
1 change: 1 addition & 0 deletions docs/api/components_home_HomeRows.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@
sub itemSelected()
m.selectedRowItem = m.top.rowItemSelected

m.global.launchSource = "home"
m.top.selectedItem = m.top.content.getChild(m.top.rowItemSelected[0]).getChild(m.top.rowItemSelected[1])

'Prevent the selected item event from double firing
Expand Down
2 changes: 1 addition & 1 deletion docs/api/components_movies_MovieDetails.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@
m.options.setFocus(true)
end if

if key = "down" and m.buttonGrp.isInFocusChain()
if key = "down" and m.buttonGrp.isInFocusChain() and m.extrasGrp.visible = true
m.top.lastFocus = m.extrasGrid
m.extrasGrid.setFocus(true)
m.top.findNode("VertSlider").reverse = false
Expand Down
17 changes: 17 additions & 0 deletions docs/api/components_tvshows_TVEpisodeRow.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,28 @@

m.top.showRowLabel = [false]

m.top.observeField("selectItemId", "onItemSelected")

updateSize()

m.top.setFocus(true)
end sub

sub onItemSelected()
Id = m.top.selectItemId

if Id <> invalid and Id <> "" and m.top.objects <> invalid
for i = 0 to m.top.objects.items.count() - 1
item = m.top.objects.items[i]
if item.id = Id
m.top.jumpToItem = i
return
end if
end for
end if
end sub


sub updateSize()
m.top.translation = [450, 180]

Expand Down
6 changes: 6 additions & 0 deletions docs/api/components_tvshows_TVEpisodeRowWithOptions.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
m.rows = m.top.findNode("tvEpisodeRow")
m.tvListOptions = m.top.findNode("tvListOptions")

m.top.observeField("selectItemId", "onItemSelected")
m.rows.observeField("doneLoading", "rowsDoneLoading")
end sub

sub onItemSelected()
Id = m.top.selectItemId
m.rows.selectItemId = Id
end sub

sub setupRows()
objects = m.top.objects
m.rows.objects = objects
Expand Down
8 changes: 8 additions & 0 deletions docs/api/components_tvshows_TVEpisodes.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

sub init()
m.top.optionsAvailable = false
m.top.observeField("selectItemId", "onItemSelected")

m.rows = m.top.findNode("picker")
m.poster = m.top.findNode("seasonPoster")
Expand All @@ -27,6 +28,11 @@
m.top.overhangTitle = tr("Loading...")
end sub

sub onItemSelected()
Id = m.top.selectItemId
m.rows.selectItemId = Id
end sub

' Updates the visibility of the Extras button based on if this season has any extra features
sub setExtraButtonVisibility()
if isValid(m.top.extrasObjects) and isValidAndNotEmpty(m.top.extrasObjects.items)
Expand Down Expand Up @@ -75,13 +81,15 @@
' OnScreenShown: Callback function when view is presented on screen
'
sub OnScreenShown()

if m.isFirstRun
m.isFirstRun = false
return
end if

m.tvEpisodeRow.setFocus(true)
m.top.refreshSeasonDetailsData = not m.top.refreshSeasonDetailsData

end sub

' Handle navigation input from the remote and act on it
Expand Down
16 changes: 15 additions & 1 deletion docs/api/components_video_OSD.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,21 @@
'
sub onProgressPercentageChanged()
m.videoPositionTime.text = secondsToHuman(m.top.positionTime, true)
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true)

osdmode = m.global.session.user.settings["ui.general.osdremainingtime"]
if m.global.session.user.settings["ui.design.hideclock"]
' in order to honor the hide clocks setting
osdmode = "remaining"
end if

if osdmode = "remaining"
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true)
else if osdmode = "timeofday"
m.videoRemainingTime.text = secondsToEndTime(m.top.remainingPositionTime)
else if osdmode = "both"
m.videoRemainingTime.text = secondsToHuman(m.top.remainingPositionTime, true) + " | " + secondsToEndTime(m.top.remainingPositionTime)
end if

m.progressBar.width = m.progressBarBackground.width * m.top.progressPercentage
end sub

Expand Down
2 changes: 1 addition & 1 deletion docs/api/data/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-ExtrasRowList.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-ShowScenes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-TVEpisodeRow.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-TVEpisodeRowWithOptions.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-TVEpisodes.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/api/module-misc.html

Large diffs are not rendered by default.

39 changes: 28 additions & 11 deletions docs/api/source_Main.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
sceneManager = CreateObject("roSGNode", "SceneManager")
sceneManager.observeField("dataReturned", m.port)

m.global.addFields({ app_loaded: false, playstateTask: playstateTask, sceneManager: sceneManager })
m.global.addFields({ app_loaded: false, playstateTask: playstateTask, sceneManager: sceneManager, launchSource: "" })
m.global.addFields({ queueManager: CreateObject("roSGNode", "QueueManager") })
m.global.addFields({ audioPlayer: CreateObject("roSGNode", "AudioPlayer") })

Expand Down Expand Up @@ -309,22 +309,39 @@
audio_stream_idx = selectedItem.selectedAudioStreamIndex
end if

launchSource = m.global.launchSource
m.global.launchSource = ""

selectedItem.selectedAudioStreamIndex = audio_stream_idx
' Display playback options dialog
if selectedItem.json.userdata.PlaybackPositionTicks > 0
m.global.queueManager.callFunc("hold", selectedItem)
playbackOptionDialog(selectedItem.json.userdata.PlaybackPositionTicks, selectedItem.json)
else
m.global.queueManager.callFunc("clear")
m.global.queueManager.callFunc("push", selectedItem)
m.global.queueManager.callFunc("playQueue")

localGlobal = m.global

' we only use this special steering logic from the home screen
if launchSource <> "home"
' Display playback options dialog
if selectedItem.json.userdata.PlaybackPositionTicks > 0
m.global.queueManager.callFunc("hold", selectedItem)
playbackOptionDialog(selectedItem.json.userdata.PlaybackPositionTicks, selectedItem.json)
else
m.global.queueManager.callFunc("clear")
m.global.queueManager.callFunc("push", selectedItem)
m.global.queueManager.callFunc("playQueue")
end if

else if localGlobal.session.user.settings["ui.general.episodenextupbehavior"] = "episode"
group = CreateMovieDetailsGroup(selectedItem)

else if localGlobal.session.user.settings["ui.general.episodenextupbehavior"] = "season"
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.json.SeasonId, selectedItem.id)

end if


else if selectedItemType = "Series"
group = CreateSeriesDetailsGroup(selectedItem.json.id)
else if selectedItemType = "Season"
if isValid(selectedItem.json) and isValid(selectedItem.json.SeriesId) and isValid(selectedItem.id)
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id)
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id, "")
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
Expand Down Expand Up @@ -865,7 +882,7 @@
else if popupNode.returnData.indexselected = 3
' User chose Go to season
if isValid(selectedItem[0].json) and isValid(selectedItem[0].json.SeriesId) and isValid(selectedItem[0].json.seasonID)
CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID)
CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID, "")
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
Expand Down
10 changes: 8 additions & 2 deletions docs/api/source_ShowScenes.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@
' Divert to season details if user setting goStraightToEpisodeListing is enabled and only one season exists.
if seasonData <> invalid and m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] and seasonData.Items.Count() = 1
stopLoadingSpinner()
return CreateSeasonDetailsGroupByID(seriesID, seasonData.Items[0].id)
return CreateSeasonDetailsGroupByID(seriesID, seasonData.Items[0].id, "")
end if
' start building SeriesDetails view
group = CreateObject("roSGNode", "TVShowDetails")
Expand Down Expand Up @@ -795,7 +795,7 @@
return group
end function

function CreateSeasonDetailsGroupByID(seriesID as string, seasonID as string) as dynamic
function CreateSeasonDetailsGroupByID(seriesID as string, seasonID as string, selectId as string) as dynamic
' validate parameters
if seriesID = "" or seasonID = "" then return invalid

Expand All @@ -807,9 +807,11 @@
stopLoadingSpinner()
return invalid
end if

' start building SeasonDetails view
group = CreateObject("roSGNode", "TVEpisodes")
group.optionsAvailable = false

' push scene asap (to prevent extra button presses when retriving series/movie info)
group.seasonData = seasonMetaData.json
group.objects = TVEpisodes(seriesID, seasonID)
Expand All @@ -823,6 +825,10 @@
' check for specials/extras for this season
group.extrasObjects = TVSeasonExtras(seasonID)

group.observeField("sceneReady", "onSceneReady")

group.selectItemId = selectId

' finished building SeasonDetails view
return group
end function
Expand Down
18 changes: 18 additions & 0 deletions docs/api/source_utils_misc.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@
return humanTime
end function

function secondsToEndTime(totalSeconds) as string
' Get the current time in seconds since midnight UTC (Unix Epoch Time)
currentUTCTime = CreateObject("roDateTime").AsSeconds()

' Calculate the target time in seconds by adding the number of seconds
targetTimeInSeconds = currentUTCTime + totalSeconds

' Create a new roDateTime object for the target time
targetDateTime = CreateObject("roDateTime")
targetDateTime.FromSeconds(targetTimeInSeconds)
targetDateTime.ToLocalTime()

formattedTime = formatTime(targetDateTime)

return formattedTime
end function


' Format time as 12 or 24 hour format based on system clock setting
function formatTime(time) as string
hours = time.getHours()
Expand Down

0 comments on commit 440cc94

Please sign in to comment.