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 Jul 28, 2024
1 parent adfa437 commit 82617e5
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 90 deletions.
2 changes: 1 addition & 1 deletion docs/api/components_ItemGrid_MovieLibraryView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
'
'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 = 1
Expand Down
12 changes: 9 additions & 3 deletions docs/api/components_ListPoster.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@

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

' Randmomise the background colors
posterBackgrounds = m.global.constants.poster_bg_pallet
m.backdrop.color = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
' Randomize the background colors
backdropColor = "#00a4db" ' set default in case global var is invalid
localGlobal = m.global

if isValid(localGlobal) and isValid(localGlobal.constants) and isValid(localGlobal.constants.poster_bg_pallet)
posterBackgrounds = localGlobal.constants.poster_bg_pallet
backdropColor = posterBackgrounds[rnd(posterBackgrounds.count()) - 1]
end if

m.backdrop.color = backdropColor
updateSize()
end sub

Expand Down
22 changes: 19 additions & 3 deletions docs/api/components_home_HomeItem.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@

sub init()
m.log = log.Logger("HomeItem")
m.itemText = m.top.findNode("itemText")
m.itemPoster = m.top.findNode("itemPoster")
initItemText()
initItemPoster()
m.itemProgress = m.top.findNode("progress")
m.itemProgressBackground = m.top.findNode("progressBackground")
m.itemIcon = m.top.findNode("itemIcon")
m.itemTextExtra = m.top.findNode("itemTextExtra")
initItemTextExtra()
m.itemPoster.observeField("loadStatus", "onPosterLoadStatusChanged")
m.unplayedCount = m.top.findNode("unplayedCount")
m.unplayedEpisodeCount = m.top.findNode("unplayedEpisodeCount")
Expand All @@ -36,6 +36,17 @@
m.backdrop.color = backdropColor
end sub

sub initItemText()
m.itemText = m.top.findNode("itemText")
end sub

sub initItemPoster()
m.itemPoster = m.top.findNode("itemPoster")
end sub

sub initItemTextExtra()
m.itemTextExtra = m.top.findNode("itemTextExtra")
end sub

sub itemContentChanged()
if isValid(m.unplayedCount) then m.unplayedCount.visible = false
Expand All @@ -45,6 +56,11 @@

itemData.Title = itemData.name ' Temporarily required while we move from "HomeItem" to "JFContentItem"

' validate to prevent crash
if not isValid(m.itemPoster) then initItemPoster()
if not isValid(m.itemText) then initItemText()
if not isValid(m.itemTextExtra) then initItemTextExtra()

m.itemPoster.width = itemData.imageWidth
m.itemText.maxWidth = itemData.imageWidth
m.itemTextExtra.width = itemData.imageWidth
Expand Down
156 changes: 80 additions & 76 deletions docs/api/components_movies_MovieDetails.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
' onMoviePosterSwapAnimationStateChange: Handler for changes to m.moviePosterSwapAnimation.state
'
sub onMoviePosterSwapAnimationStateChange()
if not isValid(m.moviePosterSwapAnimation) then return
if LCase(m.moviePosterSwapAnimation.state) <> "stopped" then return
m.moviePoster.uri = m.moviePosterSwap.uri
m.moviePoster.opacity = 1
Expand Down Expand Up @@ -97,102 +98,105 @@
sub itemContentChanged()
' Updates video metadata
item = m.top.itemContent
itemData = item.json
m.top.id = itemData.id
m.top.findNode("moviePoster").uri = m.top.itemContent.posterURL

' Set default video source if user hasn't selected one yet
if m.top.selectedVideoStreamId = "" and isValid(itemData.MediaSources)
m.top.selectedVideoStreamId = itemData.MediaSources[0].id
end if
if isValid(item) and isValid(item.json)
itemData = item.json
m.top.id = itemData.id
m.top.findNode("moviePoster").uri = m.top.itemContent.posterURL

' Set default video source if user hasn't selected one yet
if m.top.selectedVideoStreamId = "" and isValid(itemData.MediaSources)
m.top.selectedVideoStreamId = itemData.MediaSources[0].id
end if

' Find first Audio Stream and set that as default
SetDefaultAudioTrack(itemData)
' Find first Audio Stream and set that as default
SetDefaultAudioTrack(itemData)

' Handle all "As Is" fields
m.top.overhangTitle = itemData.name
setFieldText("releaseYear", itemData.productionYear)
setFieldText("overview", itemData.overview)
' Handle all "As Is" fields
m.top.overhangTitle = itemData.name
setFieldText("releaseYear", itemData.productionYear)
setFieldText("overview", itemData.overview)

if itemData.officialRating <> invalid
setFieldText("officialRating", itemData.officialRating)
else
m.infoGroup.removeChild(m.top.findNode("officialRating"))
end if

if m.global.session.user.settings["ui.movies.showRatings"]
if isValid(itemData.communityRating)
setFieldText("communityRating", int(itemData.communityRating * 10) / 10)
if itemData.officialRating <> invalid
setFieldText("officialRating", itemData.officialRating)
else
m.infoGroup.removeChild(m.top.findNode("communityRatingGroup"))
m.infoGroup.removeChild(m.top.findNode("officialRating"))
end if
if isValid(itemData.CriticRating)
setFieldText("criticRatingLabel", itemData.criticRating)
if itemData.CriticRating > 60
tomato = "pkg:/images/fresh.png"

if m.global.session.user.settings["ui.movies.showRatings"]
if isValid(itemData.communityRating)
setFieldText("communityRating", int(itemData.communityRating * 10) / 10)
else
m.infoGroup.removeChild(m.top.findNode("communityRatingGroup"))
end if
if isValid(itemData.CriticRating)
setFieldText("criticRatingLabel", itemData.criticRating)
if itemData.CriticRating > 60
tomato = "pkg:/images/fresh.png"
else
tomato = "pkg:/images/rotten.png"
end if
criticRatingIcon = m.top.findNode("criticRatingIcon")
if isValid(criticRatingIcon) then criticRatingIcon.uri = tomato
else
tomato = "pkg:/images/rotten.png"
m.infoGroup.removeChild(m.top.findNode("criticRatingGroup"))
end if
m.top.findNode("criticRatingIcon").uri = tomato
else
m.infoGroup.removeChild(m.top.findNode("communityRatingGroup"))
m.infoGroup.removeChild(m.top.findNode("criticRatingGroup"))
end if
else
m.infoGroup.removeChild(m.top.findNode("communityRatingGroup"))
m.infoGroup.removeChild(m.top.findNode("criticRatingGroup"))
end if

if type(itemData.RunTimeTicks) = "LongInteger"
setFieldText("runtime", stri(getRuntime()) + " mins")
if m.global.session.user.settings["ui.design.hideclock"] <> true
setFieldText("ends-at", tr("Ends at %1").Replace("%1", getEndTime()))
if type(itemData.RunTimeTicks) = "LongInteger"
setFieldText("runtime", stri(getRuntime()) + " mins")
if m.global.session.user.settings["ui.design.hideclock"] <> true
setFieldText("ends-at", tr("Ends at %1").Replace("%1", getEndTime()))
end if
end if
end if

if itemData.genres.count() > 0
setFieldText("genres", tr("Genres") + ": " + itemData.genres.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("genres"))
end if
if itemData.genres.count() > 0
setFieldText("genres", tr("Genres") + ": " + itemData.genres.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("genres"))
end if

' show tags if there are no genres to display
if itemData.genres.count() = 0 and isValid(itemData.tags) and itemData.tags.count() > 0
setFieldText("genres", tr("Tags") + ": " + itemData.tags.join(", "))
end if
' show tags if there are no genres to display
if itemData.genres.count() = 0 and isValid(itemData.tags) and itemData.tags.count() > 0
setFieldText("genres", tr("Tags") + ": " + itemData.tags.join(", "))
end if

directors = []
for each person in itemData.people
if person.type = "Director"
directors.push(person.name)
directors = []
for each person in itemData.people
if person.type = "Director"
directors.push(person.name)
end if
end for
if directors.count() > 0
setFieldText("director", tr("Director") + ": " + directors.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("director"))
end if
end for
if directors.count() > 0
setFieldText("director", tr("Director") + ": " + directors.join(", "))
else
m.top.findNode("details").removeChild(m.top.findNode("director"))
end if

if m.global.session.user.settings["ui.details.hidetagline"] = false
if itemData.taglines.count() > 0
setFieldText("tagline", itemData.taglines[0])
if m.global.session.user.settings["ui.details.hidetagline"] = false
if itemData.taglines.count() > 0
setFieldText("tagline", itemData.taglines[0])
end if
else
m.details.removeChild(m.tagline)
end if
else
m.details.removeChild(m.tagline)
end if

'set aired date if type is Episode
if itemData.PremiereDate <> invalid and itemData.Type = "Episode"
airDate = CreateObject("roDateTime")
airDate.FromISO8601String(itemData.PremiereDate)
m.top.findNode("aired").text = tr("Aired") + ": " + airDate.AsDateString("short-month-no-weekday")
'remove movie release year label
m.infoGroup.removeChild(m.top.findNode("releaseYear"))
end if
'set aired date if type is Episode
if itemData.PremiereDate <> invalid and itemData.Type = "Episode"
airDate = CreateObject("roDateTime")
airDate.FromISO8601String(itemData.PremiereDate)
m.top.findNode("aired").text = tr("Aired") + ": " + airDate.AsDateString("short-month-no-weekday")
'remove movie release year label
m.infoGroup.removeChild(m.top.findNode("releaseYear"))
end if

setFavoriteColor()
setWatchedColor()
SetUpVideoOptions(itemData.mediaSources)
SetUpAudioOptions(itemData.mediaStreams)
setFavoriteColor()
setWatchedColor()
SetUpVideoOptions(itemData.mediaSources)
SetUpAudioOptions(itemData.mediaStreams)
end if
m.buttonGrp.visible = true
stopLoadingSpinner()
end sub
Expand Down
9 changes: 6 additions & 3 deletions docs/api/components_video_VideoPlayerView.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,12 @@

' When Video Player state changes
sub onPositionChanged()

' Pass video position data into OSD
m.osd.progressPercentage = m.top.position / m.top.duration
if m.top.duration = 0
m.osd.progressPercentage = 0
else
m.osd.progressPercentage = m.top.position / m.top.duration
end if
m.osd.positionTime = m.top.position
m.osd.remainingPositionTime = m.top.duration - m.top.position

Expand Down Expand Up @@ -664,7 +667,7 @@
"PositionTicks": int(m.top.position) * 10000000&, 'Ensure a LongInteger is used
"IsPaused": (m.top.state = "paused")
}
if m.top.content.live
if isValid(m.top.content) and isValid(m.top.content.live) and m.top.content.live
params.append({
"MediaSourceId": m.top.transcodeParams.MediaSourceId,
"LiveStreamId": m.top.transcodeParams.LiveStreamId
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-HomeItem.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/api/source_ShowScenes.bs.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
SendPerformanceBeacon("AppDialogInitiate") ' Roku Performance monitoring - Dialog Starting

publicUsers = GetPublicUsers()
savedUsers = getSavedUsers()
numPubUsers = 0
if isValid(publicUsers) then numPubUsers = publicUsers.count()

numPubUsers = publicUsers.count()
savedUsers = getSavedUsers()
numSavedUsers = savedUsers.count()

if numPubUsers > 0 or numSavedUsers > 0
Expand Down

0 comments on commit 82617e5

Please sign in to comment.