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 17, 2024
1 parent b43198a commit 1fdcb68
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 209 deletions.
10 changes: 5 additions & 5 deletions docs/api/components_ItemGrid_GridItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@

sub itemContentChanged()
m.backdrop.blendColor = "#00a4db" ' set default in case global var is invalid
localGlobal = m.global
myGlobal = m.global

if isValid(localGlobal) and isValid(localGlobal.constants) and isValid(localGlobal.constants.poster_bg_pallet)
posterBackgrounds = localGlobal.constants.poster_bg_pallet
if isValid(myGlobal) and isValid(myGlobal.constants) and isValid(myGlobal.constants.poster_bg_pallet)
posterBackgrounds = myGlobal.constants.poster_bg_pallet
m.backdrop.blendColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
end if

Expand All @@ -64,8 +64,8 @@
m.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
else if itemData.type = "Series"
if isValid(localGlobal) and isValid(localGlobal.session) and isValid(localGlobal.session.user) and isValid(localGlobal.session.user.settings)
if localGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(myGlobal) and isValid(myGlobal.session) and isValid(myGlobal.session.user) and isValid(myGlobal.session.user.settings)
if myGlobal.session.user.settings["ui.tvshows.disableUnwatchedEpisodeCount"] = false
if isValid(itemData.json) and isValid(itemData.json.UserData) and isValid(itemData.json.UserData.UnplayedItemCount)
if itemData.json.UserData.UnplayedItemCount > 0
m.unplayedCount.visible = true
Expand Down
37 changes: 20 additions & 17 deletions docs/api/components_ItemGrid_ItemGrid.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
sub init()
m.log = log.Logger("ItemGrid")
m.log.debug("start init()")
userSettings = m.global.session.user.settings

m.options = m.top.findNode("options")

m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"]
m.showItemCount = userSettings["itemgrid.showItemCount"]

m.tvGuide = invalid
m.channelFocused = invalid
Expand Down Expand Up @@ -70,9 +72,9 @@
m.alphaMenu = m.alpha.findNode("alphaMenu")

'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
m.resetGrid = userSettings["itemgrid.reset"]

m.top.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.top.gridTitles = userSettings["itemgrid.gridTitles"]
m.log.debug("end init()")
end sub

Expand All @@ -86,6 +88,7 @@
m.log.debug("start loadInitialItems()")
m.loadItemsTask.control = "stop"
startLoadingSpinner()
userSettings = m.global.session.user.settings

if m.top.parentItem.json.Type = "CollectionFolder" 'or m.top.parentItem.json.Type = "Folder"
m.top.HomeLibraryItem = m.top.parentItem.Id
Expand All @@ -98,25 +101,25 @@
' Read view/sort/filter settings
if m.top.parentItem.collectionType = "livetv"
' Translate between app and server nomenclature
viewSetting = m.global.session.user.settings["display.livetv.landing"]
viewSetting = userSettings["display.livetv.landing"]
if viewSetting = "guide"
m.view = "tvGuide"
else
m.view = "livetv"
end if
m.sortField = m.global.session.user.settings["display.livetv.sortField"]
sortAscendingStr = m.global.session.user.settings["display.livetv.sortAscending"]
m.filter = m.global.session.user.settings["display.livetv.filter"]
m.sortField = userSettings["display.livetv.sortField"]
sortAscendingStr = userSettings["display.livetv.sortAscending"]
m.filter = userSettings["display.livetv.filter"]
else if m.top.parentItem.collectionType = "music"
m.view = m.global.session.user.settings["display.music.view"]
m.sortField = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortField"]
sortAscendingStr = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = m.global.session.user.settings["display." + m.top.parentItem.Id + ".filter"]
m.view = userSettings["display.music.view"]
m.sortField = userSettings["display." + m.top.parentItem.Id + ".sortField"]
sortAscendingStr = userSettings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = userSettings["display." + m.top.parentItem.Id + ".filter"]
else
m.sortField = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortField"]
sortAscendingStr = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = m.global.session.user.settings["display." + m.top.parentItem.Id + ".filter"]
m.view = m.global.session.user.settings["display." + m.top.parentItem.Id + ".landing"]
m.sortField = userSettings["display." + m.top.parentItem.Id + ".sortField"]
sortAscendingStr = userSettings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = userSettings["display." + m.top.parentItem.Id + ".filter"]
m.view = userSettings["display." + m.top.parentItem.Id + ".landing"]
end if

if m.sortField = invalid
Expand Down Expand Up @@ -182,7 +185,7 @@
m.loadItemsTask.itemType = "MusicArtist"
m.loadItemsTask.itemId = m.top.parentItem.Id

m.view = m.global.session.user.settings["display.music.view"]
m.view = userSettings["display.music.view"]

if m.view = "music-album"
m.loadItemsTask.itemType = "MusicAlbum"
Expand All @@ -193,7 +196,7 @@
' For LiveTV, we want to "Fit" the item images, not zoom
m.top.imageDisplayMode = "scaleToFit"

if m.global.session.user.settings["display.livetv.landing"] = "guide" and m.options.view <> "livetv"
if userSettings["display.livetv.landing"] = "guide" and m.options.view <> "livetv"
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 = "Boxsets" or m.top.parentItem.Type = "Folder" or m.top.parentItem.Type = "Channel"
Expand Down
43 changes: 26 additions & 17 deletions docs/api/components_ItemGrid_LoadVideoContentTask.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,31 @@
end sub

sub loadItems()
queueManager = m.global.queueManager

' Reset intro tracker in case task gets reused
m.top.isIntro = false

' Only show preroll once per queue
if m.global.queueManager.callFunc("isPrerollActive")
if queueManager.callFunc("isPrerollActive")
' Prerolls not allowed if we're resuming video
if m.global.queueManager.callFunc("getCurrentItem").startingPoint = 0
if queueManager.callFunc("getCurrentItem").startingPoint = 0
preRoll = GetIntroVideos(m.top.itemId)
if isValid(preRoll) and preRoll.TotalRecordCount > 0 and isValid(preRoll.items[0])
' If an error is thrown in the Intros plugin, instead of passing the error they pass the entire rick roll music video.
' Bypass the music video and treat it as an error message
if lcase(preRoll.items[0].name) <> "rick roll'd"
m.global.queueManager.callFunc("push", m.global.queueManager.callFunc("getCurrentItem"))
queueManager.callFunc("push", queueManager.callFunc("getCurrentItem"))
m.top.itemId = preRoll.items[0].id
m.global.queueManager.callFunc("setPrerollStatus", false)
queueManager.callFunc("setPrerollStatus", false)
m.top.isIntro = true
end if
end if
end if
end if

if m.top.selectedAudioStreamIndex = 0
currentItem = m.global.queueManager.callFunc("getCurrentItem")
currentItem = queueManager.callFunc("getCurrentItem")
if isValid(currentItem) and isValid(currentItem.json)
m.top.selectedAudioStreamIndex = FindPreferredAudioStream(currentItem.json.MediaStreams)
end if
Expand Down Expand Up @@ -80,6 +82,10 @@
return
end if

queueManager = m.global.queueManager
userSession = m.global.session.user
userSettings = userSession.settings

session.video.Update(meta)

if isValid(meta.json.MediaSources[0].RunTimeTicks)
Expand Down Expand Up @@ -134,15 +140,14 @@
end if

if LCase(m.top.itemType) = "episode"
userSession = m.global.session.user
if userSession.settings["playback.playnextepisode"] = "enabled" or userSession.settings["playback.playnextepisode"] = "webclient" and userSession.Configuration.EnableNextEpisodeAutoPlay
if userSettings["playback.playnextepisode"] = "enabled" or userSettings["playback.playnextepisode"] = "webclient" and userSession.Configuration.EnableNextEpisodeAutoPlay
addNextEpisodesToQueue(video.showID)
end if
end if

playbackPosition = 0!

currentItem = m.global.queueManager.callFunc("getCurrentItem")
currentItem = queueManager.callFunc("getCurrentItem")

if isValid(currentItem) and isValid(currentItem.startingPoint)
playbackPosition = currentItem.startingPoint
Expand Down Expand Up @@ -222,8 +227,8 @@
' transcode is that the Encoding Level is not supported, then try to direct play but silently
' fall back to the transcode if that fails.
if m.playbackInfo.MediaSources[0].MediaStreams.Count() > 0 and meta.live = false
tryDirectPlay = m.global.session.user.settings["playback.tryDirect.h264ProfileLevel"] and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264"
tryDirectPlay = tryDirectPlay or (m.global.session.user.settings["playback.tryDirect.hevcProfileLevel"] and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc")
tryDirectPlay = userSettings["playback.tryDirect.h264ProfileLevel"] and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "h264"
tryDirectPlay = tryDirectPlay or (userSettings["playback.tryDirect.hevcProfileLevel"] and m.playbackInfo.MediaSources[0].MediaStreams[0].codec = "hevc")
if tryDirectPlay and isValid(m.playbackInfo.MediaSources[0].TranscodingUrl) and forceTranscoding = false
transcodingReasons = getTranscodeReasons(m.playbackInfo.MediaSources[0].TranscodingUrl)
if transcodingReasons.Count() = 1 and transcodingReasons[0] = "VideoLevelNotSupported"
Expand Down Expand Up @@ -263,7 +268,8 @@
' @param {dynamic} videoID - id of video user is playing
' @return {integer} indicating the default track's server-side index. Defaults to {SubtitleSelection.none} is one is not found
function defaultSubtitleTrackFromVid(videoID) as integer
if m.global.session.user.configuration.SubtitleMode = "None"
userSession = m.global.session.user
if userSession.configuration.SubtitleMode = "None"
return SubtitleSelection.none ' No subtitles desired: return none
end if

Expand All @@ -289,7 +295,7 @@
return defaultTextSubs
end if

if not m.global.session.user.settings["playback.subs.onlytext"]
if not userSession.settings["playback.subs.onlytext"]
return defaultSubtitleTrack(subtitles["all"], selectedAudioLanguage) ' if no appropriate text subs exist, allow non-text
end if

Expand Down Expand Up @@ -493,20 +499,22 @@

' Add next episodes to the playback queue
sub addNextEpisodesToQueue(showID)
queueManager = m.global.queueManager

' Don't queue next episodes if we already have a playback queue
maxQueueCount = 1

if m.top.isIntro
maxQueueCount = 2
end if

if m.global.queueManager.callFunc("getCount") > maxQueueCount then return
if queueManager.callFunc("getCount") > maxQueueCount then return

videoID = m.top.itemId

' If first item is an intro video, use the next item in the queue
if m.top.isIntro
currentVideo = m.global.queueManager.callFunc("getItemByIndex", 1)
currentVideo = queueManager.callFunc("getItemByIndex", 1)

if isValid(currentVideo) and isValid(currentVideo.id)
videoID = currentVideo.id
Expand All @@ -528,7 +536,7 @@

if isValid(data) and data.Items.Count() > 1
for i = 1 to data.Items.Count() - 1
m.global.queueManager.callFunc("push", data.Items[i])
queueManager.callFunc("push", data.Items[i])
end for
end if
end sub
Expand Down Expand Up @@ -587,8 +595,9 @@
end function

function FindPreferredAudioStream(streams as dynamic) as integer
preferredLanguage = m.global.session.user.Configuration.AudioLanguagePreference
playDefault = m.global.session.user.Configuration.PlayDefaultAudioTrack
userConfig = m.global.session.user.configuration
preferredLanguage = userConfig.AudioLanguagePreference
playDefault = userConfig.PlayDefaultAudioTrack

if playDefault <> invalid and playDefault = true
return 1
Expand Down
20 changes: 11 additions & 9 deletions docs/api/components_ItemGrid_MovieLibraryView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

sub init()
setupNodes()
userSettings = m.global.session.user.settings

m.overhang.isVisible = false

Expand All @@ -41,7 +42,7 @@
alphaMicText = m.alpha.findNode("alphaMicText")
alphaMicText.visible = false

m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"]
m.showItemCount = userSettings["itemgrid.showItemCount"]

m.swapAnimation.observeField("state", "swapDone")

Expand Down Expand Up @@ -88,7 +89,7 @@
m.loadItemsTask.totalRecordCount = 0

'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
m.resetGrid = userSettings["itemgrid.reset"]
end sub

sub OnScreenHidden()
Expand All @@ -114,6 +115,7 @@
sub loadInitialItems()
m.loadItemsTask.control = "stop"
startLoadingSpinner(false)
userSettings = m.global.session.user.settings

if m.top.parentItem.json.Type = "CollectionFolder"
m.top.HomeLibraryItem = m.top.parentItem.Id
Expand All @@ -125,15 +127,15 @@
SetBackground("")
end if

m.sortField = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortField"]
m.filter = m.global.session.user.settings["display." + m.top.parentItem.Id + ".filter"]
m.filterOptions = m.global.session.user.settings["display." + m.top.parentItem.Id + ".filterOptions"]
m.view = m.global.session.user.settings["display." + m.top.parentItem.Id + ".landing"]
m.sortAscending = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortAscending"]
m.sortField = userSettings["display." + m.top.parentItem.Id + ".sortField"]
m.filter = userSettings["display." + m.top.parentItem.Id + ".filter"]
m.filterOptions = userSettings["display." + m.top.parentItem.Id + ".filterOptions"]
m.view = userSettings["display." + m.top.parentItem.Id + ".landing"]
m.sortAscending = userSettings["display." + m.top.parentItem.Id + ".sortAscending"]

' If user has not set a preferred view for this folder, check if they've set a default view
if not isValid(m.view)
m.view = m.global.session.user.settings["itemgrid.movieDefaultView"]
m.view = userSettings["itemgrid.movieDefaultView"]
end if

if not isValid(m.sortField) then m.sortField = "SortName"
Expand Down Expand Up @@ -202,7 +204,7 @@
m.itemGrid.numRows = "3"
m.selectedMovieOverview.visible = false
m.infoGroup.visible = false
m.top.showItemTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.top.showItemTitles = userSettings["itemgrid.gridTitles"]
if LCase(m.top.showItemTitles) = "hidealways"
m.itemGrid.itemSize = "[230, 315]"
m.itemGrid.rowHeights = "[315]"
Expand Down
16 changes: 9 additions & 7 deletions docs/api/components_ItemGrid_MusicLibraryView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

sub init()
setupNodes()
userSettings = m.global.session.user.settings

m.overhang.isVisible = false

Expand All @@ -36,7 +37,7 @@
alphaMicText = m.alpha.findNode("alphaMicText")
alphaMicText.visible = false

m.showItemCount = m.global.session.user.settings["itemgrid.showItemCount"]
m.showItemCount = userSettings["itemgrid.showItemCount"]

m.swapAnimation.observeField("state", "swapDone")

Expand Down Expand Up @@ -82,7 +83,7 @@
m.loadItemsTask.totalRecordCount = 0

'Get reset folder setting
m.resetGrid = m.global.session.user.settings["itemgrid.reset"]
m.resetGrid = userSettings["itemgrid.reset"]
end sub

sub OnScreenHidden()
Expand All @@ -108,6 +109,7 @@
sub loadInitialItems()
m.loadItemsTask.control = "stop"
startLoadingSpinner(false)
userSettings = m.global.session.user.settings

if LCase(m.top.parentItem.json.Type) = "collectionfolder"
m.top.HomeLibraryItem = m.top.parentItem.Id
Expand All @@ -119,17 +121,17 @@
SetBackground("")
end if

m.sortField = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortField"]
m.sortAscending = m.global.session.user.settings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = m.global.session.user.settings["display." + m.top.parentItem.Id + ".filter"]
m.view = m.global.session.user.settings["display." + m.top.parentItem.Id + ".landing"]
m.sortField = userSettings["display." + m.top.parentItem.Id + ".sortField"]
m.sortAscending = userSettings["display." + m.top.parentItem.Id + ".sortAscending"]
m.filter = userSettings["display." + m.top.parentItem.Id + ".filter"]
m.view = userSettings["display." + m.top.parentItem.Id + ".landing"]

if not isValid(m.sortField) then m.sortField = "SortName"
if not isValid(m.filter) then m.filter = "All"
if not isValid(m.view) then m.view = "ArtistsPresentation"
if not isValid(m.sortAscending) then m.sortAscending = true

m.top.showItemTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.top.showItemTitles = userSettings["itemgrid.gridTitles"]

if LCase(m.top.parentItem.json.type) = "musicgenre"
m.itemGrid.translation = "[96, 60]"
Expand Down
5 changes: 3 additions & 2 deletions docs/api/components_JFVideo.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
m.top.transcodeReasons = []
m.bufferCheckTimer.duration = 30

if m.global.session.user.settings["ui.design.hideclock"] = true
userSettings = m.global.session.user.settings
if userSettings["ui.design.hideclock"]
clockNode = findNodeBySubtype(m.top, "clock")
if clockNode[0] <> invalid then clockNode[0].parent.removeChild(clockNode[0].node)
end if
Expand All @@ -24,7 +25,7 @@
m.nextEpisodeButton = m.top.findNode("nextEpisode")
m.nextEpisodeButton.text = tr("Next Episode")
m.nextEpisodeButton.setFocus(false)
m.nextupbuttonseconds = m.global.session.user.settings["playback.nextupbuttonseconds"].ToInt()
m.nextupbuttonseconds = userSettings["playback.nextupbuttonseconds"].ToInt()

m.showNextEpisodeButtonAnimation = m.top.findNode("showNextEpisodeButton")
m.hideNextEpisodeButtonAnimation = m.top.findNode("hideNextEpisodeButton")
Expand Down
Loading

0 comments on commit 1fdcb68

Please sign in to comment.