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 Aug 4, 2024
1 parent db03f9a commit df50efe
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 41 deletions.
21 changes: 12 additions & 9 deletions docs/api/components_ItemGrid_GridItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@
m.checkmark.height = 60

m.itemText.translation = [0, m.itemPoster.height + 7]

m.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
m.itemText.visible = m.gridTitles = "showalways"

' Add some padding space when Item Titles are always showing
if m.itemText.visible then m.itemText.maxWidth = 250

'Parent is MarkupGrid and it's parent is the ItemGrid
m.topParent = m.top.GetParent().GetParent()
'Get the imageDisplayMode for these grid items
if isValid(m.topParent.imageDisplayMode)
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
' grab data from ItemGrid node
m.itemGrid = m.top.GetParent().GetParent() 'Parent is MarkupGrid and it's parent is the ItemGrid

if isValid(m.itemGrid)
if isValid(m.itemGrid.imageDisplayMode)
m.itemPoster.loadDisplayMode = m.itemGrid.imageDisplayMode
end if
if isValid(m.itemGrid.gridTitles)
m.gridTitles = m.itemGrid.gridTitles
end if
end if

end sub
Expand Down Expand Up @@ -93,7 +96,7 @@
m.itemPoster.uri = itemData.PosterUrl
'm.itemIcon.uri = itemData.iconUrl
m.itemText.text = itemData.Title
m.itemPoster.loadDisplayMode = m.topParent.imageDisplayMode
m.itemPoster.loadDisplayMode = m.itemGrid.imageDisplayMode
else if itemData.type = "Video"
m.itemPoster.uri = itemData.PosterUrl
m.itemIcon.uri = itemData.iconUrl
Expand Down Expand Up @@ -186,7 +189,7 @@
m.posterMask.scale = [1, 1]
else
m.itemText.repeatCount = 0
if m.topParent.alphaActive = true
if m.itemGrid.alphaActive = true
m.posterMask.scale = [0.85, 0.85]
end if
end if
Expand Down
17 changes: 3 additions & 14 deletions docs/api/components_ItemGrid_ItemGrid.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@

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

m.top.gridTitles = m.global.session.user.settings["itemgrid.gridTitles"]
end sub

'
'Genre Item Selected
sub onGenreItemSelected()
m.top.selectedItem = m.genreList.content.getChild(m.genreList.rowItemSelected[0]).getChild(m.genreList.rowItemSelected[1])
end sub

'
'Load initial set of Data
sub loadInitialItems()
m.loadItemsTask.control = "stop"
Expand Down Expand Up @@ -445,7 +445,6 @@
m.options.options = options
end sub

'
'Handle loaded data, and add to Grid
sub ItemDataLoaded(msg)
itemData = msg.GetData()
Expand Down Expand Up @@ -506,7 +505,6 @@
stopLoadingSpinner()
end sub

'
'Set Background Image
sub SetBackground(backgroundUri as string)

Expand All @@ -519,7 +517,6 @@
m.newBackdrop.uri = backgroundUri
end sub

'
'Handle new item being focused
sub onItemFocused()

Expand All @@ -545,7 +542,6 @@
end if
end sub

'
'When Image Loading Status changes
sub newBGLoaded()
'If image load was sucessful, start the fade swap
Expand All @@ -554,12 +550,9 @@
end if
end sub

'
'Swap Complete
sub swapDone()

if m.swapAnimation.state = "stopped"

if isValid(m.swapAnimation) and m.swapAnimation.state = "stopped"
'Set main BG node image and hide transitioning node
m.backdrop.uri = m.newBackdrop.uri
m.backdrop.opacity = 0.25
Expand All @@ -573,7 +566,6 @@
end if
end sub

'
'Load next set of items
sub loadMoreData()
if m.Loading = true then return
Expand All @@ -585,7 +577,6 @@
m.loadItemsTask.control = "RUN"
end sub

'
'Item Selected
sub onItemSelected()
m.top.selectedItem = m.itemGrid.content.getChild(m.itemGrid.itemSelected)
Expand Down Expand Up @@ -636,8 +627,6 @@
end if
end sub


'
'Check if options updated and any reloading required
sub optionsClosed()
if m.top.parentItem.collectionType = "livetv" and m.options.view <> m.view
Expand Down
2 changes: 2 additions & 0 deletions docs/api/components_ItemGrid_ItemGridOptions.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
end sub

sub toggleFavorite()
if not isValid(m.selectedFavoriteItem) then return

m.favItemsTask = createObject("roSGNode", "FavoriteItemsTask")
if m.favoriteMenu.iconUri = "pkg:/images/icons/favorite.png"
m.favoriteMenu.iconUri = "pkg:/images/icons/favorite_selected.png"
Expand Down
16 changes: 10 additions & 6 deletions docs/api/components_ItemGrid_LoadVideoContentTask.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
end enum

sub init()
m.user = AboutMe()
m.top.functionName = "loadItems"
end sub

Expand Down Expand Up @@ -121,8 +120,7 @@
video.logoImage = api.items.GetImageURL(logoLookupID, "logo", 0, { "maxHeight": 65, "maxWidth": 300, "quality": "90" })
end if

user = AboutMe()
if user.Configuration.EnableNextEpisodeAutoPlay
if m.global.session.user.Configuration.EnableNextEpisodeAutoPlay
if LCase(m.top.itemType) = "episode"
addNextEpisodesToQueue(video.showID)
end if
Expand Down Expand Up @@ -397,6 +395,12 @@
end sub

sub addSubtitlesToVideo(video, meta)
if not isValid(meta) then return
if not isValid(meta.id) then return
if not isValid(m.playbackInfo) then return
if not isValidAndNotEmpty(m.playbackInfo.MediaSources) then return
if not isValid(m.playbackInfo.MediaSources[0].MediaStreams) then return

subtitles = sortSubtitles(meta.id, m.playbackInfo.MediaSources[0].MediaStreams)
safesubs = subtitles["all"]
subtitleTracks = []
Expand Down Expand Up @@ -567,16 +571,16 @@
end function

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

if playDefault <> invalid and playDefault = true
return 1
end if

' Do we already have the MediaStreams or not?
if streams = invalid
url = Substitute("Users/{0}/Items/{1}", m.user.id, m.top.itemId)
url = Substitute("Users/{0}/Items/{1}", m.global.session.user.id, m.top.itemId)
resp = APIRequest(url)
jsonResponse = getJson(resp)

Expand Down
23 changes: 21 additions & 2 deletions docs/api/components_extras_ExtrasItem.bs.html

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion docs/api/components_home_HomeItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
end if

' update the backdrop node
m.backdrop = m.top.findNode("backdrop")
initBackdrop()
m.backdrop.color = backdropColor
end sub

Expand All @@ -48,6 +48,10 @@
m.itemTextExtra = m.top.findNode("itemTextExtra")
end sub

sub initBackdrop()
m.backdrop = m.top.findNode("backdrop")
end sub

sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
itemData = m.top.itemContent
Expand All @@ -60,6 +64,7 @@
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()
if not isValid(m.backdrop) then initBackdrop()

m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
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-ExtrasItem.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.

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

Large diffs are not rendered by default.

17 changes: 14 additions & 3 deletions docs/api/source_Main.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,12 @@
else if selectedItemType = "Series"
group = CreateSeriesDetailsGroup(selectedItem.json.id)
else if selectedItemType = "Season"
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id)
if isValid(selectedItem.json) and isValid(selectedItem.json.SeriesId) and isValid(selectedItem.id)
group = CreateSeasonDetailsGroupByID(selectedItem.json.SeriesId, selectedItem.id)
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
end if
else if selectedItemType = "Movie"
' open movie detail page
group = CreateMovieDetailsGroup(selectedItem)
Expand Down Expand Up @@ -815,7 +820,7 @@
selectedItem = m.global.queueManager.callFunc("getHold")
m.global.queueManager.callFunc("clearHold")

if isValid(selectedItem) and selectedItem.count() > 0 and isValid(selectedItem[0])
if isValidAndNotEmpty(selectedItem) and isValid(selectedItem[0])
if popupNode.returnData.indexselected = 0
'Resume video from resume point
startLoadingSpinner()
Expand Down Expand Up @@ -843,7 +848,13 @@
CreateSeriesDetailsGroup(selectedItem[0].json.SeriesId)
else if popupNode.returnData.indexselected = 3
' User chose Go to season
CreateSeasonDetailsGroupByID(selectedItem[0].json.SeriesId, selectedItem[0].json.seasonID)
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)
else
stopLoadingSpinner()
message_dialog(tr("Error loading Season"))
end if

else if popupNode.returnData.indexselected = 4
' User chose Go to episode
CreateMovieDetailsGroup(selectedItem[0])
Expand Down
2 changes: 1 addition & 1 deletion docs/api/source_ShowScenes.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
' Get season data early in the function so we can check number of seasons.
seasonData = TVSeasons(seriesID)
' Divert to season details if user setting goStraightToEpisodeListing is enabled and only one season exists.
if m.global.session.user.settings["ui.tvshows.goStraightToEpisodeListing"] = true and seasonData.Items.Count() = 1
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)
end if
Expand Down
4 changes: 3 additions & 1 deletion docs/api/source_api_Items.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"limit": 100
})

if data = invalid then return []

results = []
for each item in data.Items
tmp = CreateObject("roSGNode", "SearchData")
Expand Down Expand Up @@ -97,7 +99,7 @@
tmp.image = PosterImage(data.id, imgParams)
tmp.json = data
return tmp
else if LCase(data.type) = "recording"
else if data.type = "Recording"
tmp = CreateObject("roSGNode", "RecordingData")
tmp.image = PosterImage(data.id, imgParams)
tmp.json = data
Expand Down

0 comments on commit df50efe

Please sign in to comment.