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 6, 2024
1 parent 6756b01 commit 8e4d155
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 64 deletions.
8 changes: 7 additions & 1 deletion docs/api/components_ItemGrid_GridItemSmall.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sub init()
m.itemPoster = m.top.findNode("itemPoster")
m.posterText = m.top.findNode("posterText")
m.title = m.top.findNode("title")
initTitle()
m.posterText.font.size = 30
m.title.font.size = 25
m.backdrop = m.top.findNode("backdrop")
Expand All @@ -25,6 +25,10 @@
end if
end sub

sub initTitle()
m.title = m.top.findNode("title")
end sub

sub itemContentChanged()
m.backdrop.blendColor = "#101010"

Expand Down Expand Up @@ -56,6 +60,8 @@
end sub

sub focusChanged()
if not isValid(m.title) then initTitle()

if m.top.itemHasFocus = true
m.title.repeatCount = -1
else
Expand Down
30 changes: 24 additions & 6 deletions docs/api/components_ItemGrid_LoadVideoContentTask.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import "pkg:/source/api/Image.bs"
import "pkg:/source/api/userauth.bs"
import "pkg:/source/utils/deviceCapabilities.bs"
import "pkg:/source/utils/session.bs"

enum SubtitleSelection
notset = -2
Expand Down Expand Up @@ -73,14 +74,24 @@
sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_stream_idx = 1 as integer, forceTranscoding = false as boolean)

meta = ItemMetaData(video.id)
subtitle_idx = m.top.selectedSubtitleIndex

if not isValid(meta)
video.errorMsg = "Error loading metadata"
video.content = invalid
return
end if

session.video.Update(meta)

if isValid(meta.json.MediaSources[0].RunTimeTicks)
if meta.json.MediaSources[0].RunTimeTicks = 0
video.length = 0
else
video.length = meta.json.MediaSources[0].RunTimeTicks / 10000000
end if
end if
video.MaxVideoDecodeResolution = [meta.json.MediaSources[0].MediaStreams[0].Width, meta.json.MediaSources[0].MediaStreams[0].Height]

subtitle_idx = m.top.selectedSubtitleIndex
videotype = LCase(meta.type)

' Check for any Live TV streams or Recordings coming from other places other than the TV Guide
Expand Down Expand Up @@ -185,6 +196,11 @@
end if

video.container = getContainerType(meta)
if video.container = "mp4"
video.content.StreamFormat = "mp4"
else if video.container = "mkv"
video.content.StreamFormat = "mkv"
end if

if not isValid(m.playbackInfo.MediaSources[0])
m.playbackInfo = meta.json
Expand All @@ -199,12 +215,10 @@
}
end if


' 'TODO: allow user selection of subtitle track before playback initiated, for now set to no subtitles
video.directPlaySupported = m.playbackInfo.MediaSources[0].SupportsDirectPlay
fully_external = false


' For h264/hevc video, Roku spec states that it supports specfic encoding levels
' The device can decode content with a Higher Encoding level but may play it back with certain
' artifacts. If the user preference is set, and the only reason the server says we need to
Expand Down Expand Up @@ -353,11 +367,15 @@
protocol = LCase(m.playbackInfo.MediaSources[0].Protocol)
if protocol <> "file"
uri = parseUrl(m.playbackInfo.MediaSources[0].Path)
if isLocalhost(uri[2])
if not isValidAndNotEmpty(uri) then return

if isValid(uri[2]) and isLocalhost(uri[2])
' if the domain of the URI is local to the server,
' create a new URI by appending the received path to the server URL
' later we will substitute the users provided URL for this case
video.content.url = buildURL(uri[4])
if isValid(uri[4])
video.content.url = buildURL(uri[4])
end if
else
fully_external = true
video.content.url = m.playbackInfo.MediaSources[0].Path
Expand Down
2 changes: 0 additions & 2 deletions docs/api/components_ItemGrid_MusicArtistGridItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
end if

m.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.posterText.visible = false
m.postTextBackground.visible = false

end sub

sub itemContentChanged()
Expand Down
17 changes: 14 additions & 3 deletions docs/api/components_captionTask.bs.html

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion docs/api/components_data_PersonData.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@

sub setFields()
json = m.top.json
m.top.Type = "Person"

if json = invalid then return

m.top.id = json.id
m.top.favorite = json.UserData.isFavorite
m.top.Type = "Person"
setPoster()
end sub

Expand Down
21 changes: 17 additions & 4 deletions docs/api/components_home_HomeItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
initItemPoster()
m.itemProgress = m.top.findNode("progress")
m.itemProgressBackground = m.top.findNode("progressBackground")
m.itemIcon = m.top.findNode("itemIcon")
initItemIcon()
initItemTextExtra()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
m.playedIndicator = m.top.findNode("playedIndicator")
initPlayedIndicator()

m.showProgressBarAnimation = m.top.findNode("showProgressBar")
m.showProgressBarField = m.top.findNode("showProgressBarField")
Expand Down Expand Up @@ -52,6 +52,14 @@
m.backdrop = m.top.findNode("backdrop")
end sub

sub initItemIcon()
m.itemIcon = m.top.findNode("itemIcon")
end sub

sub initPlayedIndicator()
m.playedIndicator = m.top.findNode("playedIndicator")
end sub

sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
Expand All @@ -65,6 +73,8 @@
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()
if not isValid(m.backdrop) then initBackdrop()
if not isValid(m.itemIcon) then initItemIcon()
if not isValid(m.playedIndicator) then initPlayedIndicator()

m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
Expand All @@ -85,11 +95,14 @@

if LCase(itemData.type) = "series"
if isValid(localGlobal) and isValid(localGlobal.session) and isValid(localGlobal.session.user) and isValid(localGlobal.session.user.settings)
if not localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"]
unwatchedEpisodeCountSetting = localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"]
if isValid(unwatchedEpisodeCountSetting) and not unwatchedEpisodeCountSetting
if isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
if isValid(m.unplayedCount) then m.unplayedCount.visible = true
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
if isValid(m.unplayedEpisodeCount)
m.unplayedEpisodeCount.text = itemData.json.UserData.UnplayedItemCount
end if
end if
end if
end if
Expand Down
6 changes: 4 additions & 2 deletions docs/api/components_tvshows_TVShowDetails.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@

sub onShuffleEpisodeDataLoaded()
m.getShuffleEpisodesTask.unobserveField("data")
m.global.queueManager.callFunc("set", m.getShuffleEpisodesTask.data.items)
m.global.queueManager.callFunc("playQueue")
if isValid(m.getShuffleEpisodesTask.data)
m.global.queueManager.callFunc("set", m.getShuffleEpisodesTask.data.items)
m.global.queueManager.callFunc("playQueue")
end if
end sub

function onKeyEvent(key as string, press as boolean) as boolean
Expand Down
21 changes: 11 additions & 10 deletions docs/api/components_video_VideoPlayerView.bs.html

Large diffs are not rendered by default.

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-GridItemSmall.html

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

61 changes: 37 additions & 24 deletions docs/api/source_Main.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,12 @@
' Find the object in the scene's data and update its json data
for i = 0 to currentScene.objects.Items.count() - 1
if LCase(currentScene.objects.Items[i].id) = LCase(currentEpisode.id)
currentScene.objects.Items[i].json = api.users.GetItem(m.global.session.user.id, currentEpisode.id)
m.global.queueManager.callFunc("setTopStartingPoint", currentScene.objects.Items[i].json.UserData.PlaybackPositionTicks)

data = api.users.GetItem(m.global.session.user.id, currentEpisode.id)
if isValid(data)
currentScene.objects.Items[i].json = data
m.global.queueManager.callFunc("setTopStartingPoint", data.UserData.PlaybackPositionTicks)
end if
exit for
end if
end for
Expand All @@ -246,15 +250,19 @@
currentScene = m.global.sceneManager.callFunc("getActiveScene")

if isValid(currentScene) and isValid(currentScene.itemContent) and isValid(currentScene.itemContent.id)
' Refresh movie detail data
currentScene.itemContent.json = api.users.GetItem(m.global.session.user.id, currentScene.itemContent.id)
movieMetaData = ItemMetaData(currentScene.itemContent.id)

' Redraw movie poster
currentScene.newPosterImageURI = movieMetaData.posterURL

' Set updated starting point for the queue item
m.global.queueManager.callFunc("setTopStartingPoint", currentScene.itemContent.json.UserData.PlaybackPositionTicks)
data = api.users.GetItem(m.global.session.user.id, currentScene.itemContent.id)
if isValid(data)
currentScene.itemContent.json = data
' Set updated starting point for the queue item
m.global.queueManager.callFunc("setTopStartingPoint", data.UserData.PlaybackPositionTicks)

' Refresh movie detail data
movieMetaData = ItemMetaData(currentScene.itemContent.id)
if isValid(movieMetaData)
' Redraw movie poster
currentScene.newPosterImageURI = movieMetaData.posterURL
end if
end if
end if

stopLoadingSpinner()
Expand Down Expand Up @@ -579,36 +587,41 @@
' If a button is selected, we have some determining to do
btn = getButton(msg)
group = sceneManager.callFunc("getActiveScene")

if isValid(btn) and btn.id = "play-button"
if not isValid(group) then return

' User chose Play button from movie detail view
startLoadingSpinner()
' Check if a specific Audio Stream was selected
audio_stream_idx = 0
if isValid(group) and isValid(group.selectedAudioStreamIndex)
if isValid(group.selectedAudioStreamIndex)
audio_stream_idx = group.selectedAudioStreamIndex
end if

group.itemContent.selectedAudioStreamIndex = audio_stream_idx
group.itemContent.id = group.selectedVideoStreamId
if isValid(group.itemContent)
group.itemContent.selectedAudioStreamIndex = audio_stream_idx
group.itemContent.id = group.selectedVideoStreamId

' Display playback options dialog
if group.itemContent.json.userdata.PlaybackPositionTicks > 0
m.global.queueManager.callFunc("hold", group.itemContent)
playbackOptionDialog(group.itemContent.json.userdata.PlaybackPositionTicks, group.itemContent.json)
else
m.global.queueManager.callFunc("clear")
m.global.queueManager.callFunc("push", group.itemContent)
m.global.queueManager.callFunc("playQueue")
' Display playback options dialog
if group.itemContent.json.userdata.PlaybackPositionTicks > 0
m.global.queueManager.callFunc("hold", group.itemContent)
playbackOptionDialog(group.itemContent.json.userdata.PlaybackPositionTicks, group.itemContent.json)
else
m.global.queueManager.callFunc("clear")
m.global.queueManager.callFunc("push", group.itemContent)
m.global.queueManager.callFunc("playQueue")
end if
end if

if isValid(group) and isValid(group.lastFocus) and isValid(group.lastFocus.id) and group.lastFocus.id = "main_group"
if isValid(group.lastFocus) and isValid(group.lastFocus.id) and group.lastFocus.id = "main_group"
buttons = group.findNode("buttons")
if isValid(buttons)
group.lastFocus = group.findNode("buttons")
end if
end if

if isValid(group) and isValid(group.lastFocus)
if isValid(group.lastFocus)
group.lastFocus.setFocus(true)
end if

Expand Down
10 changes: 7 additions & 3 deletions docs/api/source_VideoPlayer.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,20 @@
protocol = LCase(m.playbackInfo.MediaSources[0].Protocol)
if protocol <> "file"
uri = parseUrl(m.playbackInfo.MediaSources[0].Path)
if isLocalhost(uri[2])
if not isValidAndNotEmpty(uri) then return

if isValid(uri[2]) and isLocalhost(uri[2])
' the domain of the URI is local to the server.
' create a new URI by appending the received path to the server URL
' later we will substitute the users provided URL for this case
video.content.url = buildURL(uri[4])
if isValid(uri[4])
video.content.url = buildURL(uri[4])
end if
else
fully_external = true
video.content.url = m.playbackInfo.MediaSources[0].Path
end if
else:
else
params.append({
"Static": "true",
"Container": video.container,
Expand Down
36 changes: 31 additions & 5 deletions docs/api/source_api_Items.bs.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/api/source_utils_deviceCapabilities.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,12 @@
"Value": "Main",
"IsRequired": true
},
{
"Condition": "NotEquals",
"Property": "AudioProfile",
"Value": "HE-AAC",
"IsRequired": true
},
{
"Condition": "LessThanEqual",
"Property": "AudioChannels",
Expand Down

0 comments on commit 8e4d155

Please sign in to comment.