Methods

(static) AssocArrayEqual(Array1, Array2) → {boolean}

Parameters:
NameTypeDescription
Array1object
Array2object
Returns:
Type: 
boolean

(static) addOrdinalSuffix(day) → {string}

Parameters:
NameTypeDescription
dayinteger
Returns:
Type: 
string

(static) arrayHasValue(arr, value) → {boolean}

Check if a specific value is inside of an array

Parameters:
NameTypeDescription
arrobject
valuedynamic
Returns:
Type: 
boolean

(static) computeProgramBroadcastProgress(playStart, playDuration, nowSeconds) → {float}

Computes a broadcast program's elapsed-time percentage. Programs are live broadcasts, not streamed media — so "progress" is wall-clock elapsed, not UserData.PlayedPercentage. Returns 0 (not 100) for finished programs because JRPoster only cleanly removes the VideoProgressBar child when playedPercentage = 0.

Parameters:
NameTypeDescription
playStartinteger

epoch seconds when the program started (0 = unknown)

playDurationinteger

program length in seconds (0 = unknown)

nowSecondsinteger

current epoch seconds (injected for testability)

Returns:

float in (0, 100) while airing, or 0 when not airing / invalid

Type: 
float

(static) displayToast(message, toastTypeopt) → {void}

displayToast: Display a transient toast notification via the scene-level Toast component.

Parameters:
NameTypeAttributesDefaultDescription
messagestring

The message to display

toastTypestring<optional>
"error"

"error", "success", or "info"

Returns:
Type: 
void

(static) divCeiling(a, b) → {integer}

Parameters:
NameTypeDescription
ainteger
binteger
Returns:
Type: 
integer

(static) filterNodeArray(nodeArray, nodeKey, excludeArray) → {object}

Filters an array of nodes, excluding any whose nodeKey value appears in excludeArray

Parameters:
NameTypeDescription
nodeArrayobject

Array of nodes to filter

nodeKeystring

Field name to check on each node

excludeArrayobject

Array of values to exclude

Returns:

Filtered array with excluded nodes removed

Type: 
object

(static) findNodeBySubtype(node, subtype) → {dynamic}

Parameters:
NameTypeDescription
nodedynamic
subtypedynamic
Returns:
Type: 
dynamic

(static) findParentOfType(node, typeName) → {object}

Traverses up the node hierarchy to find a parent node of a specific type This is useful for finding the main component when handling button events

Parameters:
NameTypeDescription
nodeobject
typeNamestring
Returns:
Type: 
object

(static) findParentWithField(node, fieldName) → {object}

Traverses up the node hierarchy to find a parent node that has a specific field This is useful for finding the main component when handling button events

Parameters:
NameTypeDescription
nodeobject
fieldNamestring
Returns:
Type: 
object

(static) formatIsoDateVideo(isoDateString) → {string}

convert iso date string to a human readable date string eg. "March 13th, 2014"

Parameters:
NameTypeDescription
isoDateStringstring
Returns:
Type: 
string

(static) formatTime(time) → {string}

Format time as 12 or 24 hour format based on system clock setting NOTE: This is NOT used by app's clock, only for displaying time in dialogs

Parameters:
NameTypeDescription
timedynamic
Returns:
Type: 
string

(static) getApiVersionFromGlobal() → {integer}

Returns the current API version from global state with a safe default of 2. Works in both class and non-class contexts (components, namespaces, functions). This is the single source of truth for reading m.global.server.apiVersion.

Returns:

API version (default: 2 if not set, unset (0), or invalid)

Type: 
integer

(static) getButton(msg, subnodeopt) → {object}

Parameters:
NameTypeAttributesDefaultDescription
msgdynamic
subnodestring<optional>
"buttons"
Returns:
Type: 
object

(static) getDialogResult(dialog, port) → {dynamic}

Returns the item selected or -1 on backpress or other unhandled closure of dialog.

Parameters:
NameTypeDescription
dialogdynamic
portdynamic
Returns:
Type: 
dynamic

(static) getFirstAudioStreamIndex(streams) → {integer}

Returns the Jellyfin index of the first audio stream in the streams array

Parameters:
NameTypeDescription
streamsdynamic

Array of media streams from Jellyfin

Returns:
  • Jellyfin index of first audio stream, or 0 if not found
Type: 
integer

(static) getFirstVideoStream(mediaStreams) → {dynamic}

getFirstVideoStream: Finds the first video stream in MediaStreams array MediaStreams[0] is not always a video stream - it could be subtitle or audio

Parameters:
NameTypeDescription
mediaStreamsroArray

Array of media streams from playback info

Returns:

First video stream object, or invalid if not found

Type: 
dynamic

(static) getGlobalSplashScreenSetting() → {string}

getGlobalSplashScreenSetting: Gets the global splash screen setting from registry or default

Reads from global registry first. If not found (user never changed it), reads default from settings.json (single source of truth). Works before user login since global settings are device-wide.

Returns:
  • Global splash screen setting value ("enabled" or "disabled")
Type: 
string

(static) getMinutes(ticks) → {integer}

Converts ticks to minutes

Parameters:
NameTypeDescription
ticksdynamic
Returns:
Type: 
integer

(static) getMsgPicker(msg, subnodeopt) → {object}

Parameters:
NameTypeAttributesDefaultDescription
msgdynamic
subnodestring<optional>
""
Returns:
Type: 
object

(static) getRokuAudioTrackPosition(jellyfinAudioIndex, audioStreamsArray, availableAudioTracksopt) → {string}

Converts a Jellyfin audio stream index to a Roku audioTrack Track identifier. For MKV direct play, Roku exposes tracks using 1-based MKV track numbers that include ALL track types (video, audio, subtitle). Jellyfin's stream Index is 0-based and also counts all track types, so Roku Track = Jellyfin Index + 1.

When availableAudioTracks is provided (populated by Roku during active playback), matches by language with ordinal disambiguation: among same-language Jellyfin streams (in original order), find the position N of the chosen index, then return the Nth same-language Roku track. This avoids returning the wrong track when multiple streams share a language (e.g. main + commentary, both English — issue #500). Falls back to Index + 1 mapping when availableAudioTracks is not available or no ordinal match can be found (e.g., before playback starts or for non-MKV containers).

Parameters:
NameTypeAttributesDefaultDescription
jellyfinAudioIndexinteger

The Jellyfin audio stream index

audioStreamsArraydynamic

Jellyfin fullAudioData array (must have .index and .language fields)

availableAudioTracksdynamic<optional>
invalid

Roku's availableAudioTracks array (has .track and .language)

Returns:
  • Roku track identifier string for audioTrack field
Type: 
string

(static) getTimePeriod(time) → {string}

Returns "am" or "pm" for 12h clock, empty string for 24h.

Parameters:
NameTypeDescription
timeobject
Returns:
Type: 
string

(static) inArray(haystack, needle) → {boolean}

Search string array for search value. Return if it's found

Parameters:
NameTypeDescription
haystackdynamic
needledynamic
Returns:
Type: 
boolean

(static) inferServerUrl(url) → {string}

take an incomplete url string and use it to make educated guesses about the complete url. then tests these guesses to see if it can find a jf server returns the url of the server it found, or an empty string

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
string

(static) injectApiParams(params, apiVersion, imageDefaults) → {object}

injectApiParams: Pure function to inject default image parameters and version-specific fields Separated from ApiClient for testability without network I/O

Parameters:
NameTypeDescription
paramsobject

Original query parameters from caller

apiVersioninteger

API version (1 for pre-10.9, 2+ for 10.9+)

imageDefaultsobject

Default image parameters (e.g., { EnableImageTypes: "Primary,Backdrop,Logo,Thumb", ImageTypeLimit: 1 })

Returns:

New params object with defaults merged and version-specific fields added

Type: 
object

(static) isAllValid(input) → {boolean}

Returns whether or not all items in passed array are valid

Parameters:
NameTypeDescription
inputobject
Returns:
Type: 
boolean

(static) isChainValid(root, propertyPath) → {boolean}

isChainValid: Returns whether or not all the properties in the passed property chain are valid. Stops evaluating at first found false value

Parameters:
NameTypeDescription
rootdynamic

high-level object to test property chain against

propertyPathstring

chain of properties under root object to test

Returns:

indicating if all properties in chain are valid

Type: 
boolean

(static) isJellyfinServer(systemInfo) → {boolean}

accepts the raw json string of /system/info/public and returns a boolean indicating if ProductName is "Jellyfin Server"

Parameters:
NameTypeDescription
systemInfoobject
Returns:
Type: 
boolean

(static) isLocalhost(url) → {boolean}

Returns true if the string is a loopback, such as 'localhost' or '127.0.0.1'

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
boolean

(static) isNodeEvent(msg, field) → {boolean}

Parameters:
NameTypeDescription
msgdynamic
fieldstring
Returns:
Type: 
boolean

(static) isValid(input) → {boolean}

Returns whether or not passed value is valid

Parameters:
NameTypeDescription
inputdynamic
Returns:
Type: 
boolean

(static) isValidAndNotEmpty(input) → {boolean}

Returns whether or not passed value is valid and not empty Accepts a string, or any countable type (arrays and lists)

Parameters:
NameTypeDescription
inputdynamic
Returns:
Type: 
boolean

(static) lastFocusedChild(obj) → {object}

Parameters:
NameTypeDescription
objobject
Returns:
Type: 
object

(static) leftPad(base, fill, length) → {string}

Parameters:
NameTypeDescription
basestring
fillstring
lengthinteger
Returns:
Type: 
string

(static) messageDialog(messageopt) → {dynamic}

Parameters:
NameTypeAttributesDefaultDescription
messagestring<optional>
""
Returns:
Type: 
dynamic

(static) optionDialog(options, messageopt, defaultSelectionopt) → {integer}

Parameters:
NameTypeAttributesDefaultDescription
optionsdynamic
messagedynamic<optional>
""
defaultSelectiondynamic<optional>
0
Returns:
Type: 
integer

(static) parseUrl(url) → {object}

Returns an array from a url = [ url, proto, host, port, subdir+params ] If port or subdir are not found, an empty string will be added to the array Proto must be declared or array will be empty

Parameters:
NameTypeDescription
urlstring
Returns:
Type: 
object

(static) resolveApiVersion(serverVersion) → {integer}

Maps a Jellyfin server version string to an API version integer used by the SDK dispatcher. V1: Covers pre-10.9 servers (10.7.x, 10.8.x) — uses /Users/{userId}/ path prefix V2: Covers 10.9+ servers — endpoints moved to top-level, userId passed as query param Returns 1 if serverVersion is empty/invalid (safe fallback to legacy paths)

Parameters:
NameTypeDescription
serverVersionstring
Returns:
Type: 
integer

(static) resolveSplashScreen(globalSplashSetting, serverSplashEnabled) → {boolean}

resolveSplashScreen: Resolves whether to show the splash screen on User Select screen

Checks JellyRock global setting. If "disabled", never shows splash. Otherwise follows server branding configuration. Ensures a valid boolean is always returned.

Parameters:
NameTypeDescription
globalSplashSettingdynamic

JellyRock global splash screen setting ("enabled", "disabled", or invalid)

serverSplashEnableddynamic

Server's splashscreenEnabled setting (boolean or invalid)

Returns:
  • Resolved splash screen enabled state (guaranteed boolean)
Type: 
boolean

(static) roundNumber(f) → {integer}

Rounds number to nearest integer

Parameters:
NameTypeDescription
ffloat
Returns:
Type: 
integer

(static) secondsToTimestamp(totalSeconds, addLeadingMinuteZero) → {string}

Converts seconds to a human readable timestamp. Used for progress bar during playback eg. 3661 seconds = "01:01:01"

Parameters:
NameTypeDescription
totalSecondsinteger
addLeadingMinuteZeroboolean
Returns:
Type: 
string

(static) setFieldTextValue(field, value) → {void}

Parameters:
NameTypeDescription
fielddynamic
valuedynamic
Returns:
Type: 
void

(static) showDialog(message, optionsopt, defaultSelectionopt) → {integer}

Parameters:
NameTypeAttributesDefaultDescription
messagestring
optionsdynamic<optional>
[]
defaultSelectiondynamic<optional>
0
Returns:
Type: 
integer

(static) shuffleArray(array) → {object}

Takes an array of data, shuffles the order, then returns the array uses the Fisher-Yates shuffling algorithm

Parameters:
NameTypeDescription
arrayobject
Returns:
Type: 
object

(static) startLoadingSpinner(disableRemoteopt, loadingTextopt) → {void}

startLoadingSpinner: Start a loading spinner and attach it to the main JRScene. Displays an invisible ProgressDialog node by default to disable keypresses while loading.

Parameters:
NameTypeAttributesDefaultDescription
disableRemoteboolean<optional>
true
loadingTextstring<optional>
""
Returns:
Type: 
void

(static) stopLoadingSpinner() → {void}

Returns:
Type: 
void

(static) ticksToHuman(ticks) → {string}

Parameters:
NameTypeDescription
tickslonginteger
Returns:
Type: 
string

(static) ticksToMinutes(ticks) → {longinteger}

Converts ticks to number of minutes eg. 3661 totalSeconds = 61

Parameters:
NameTypeDescription
tickslonginteger
Returns:
Type: 
longinteger

(static) toBoolean(value) → {dynamic}

convert value to boolean and return value

Parameters:
NameTypeDescription
valuedynamic
Returns:
Type: 
dynamic

(static) toString(input) → {string}

Parameters:
NameTypeDescription
inputdynamic
Returns:
Type: 
string

(static) urlCandidates(input) → {dynamic}

this is the "educated guess" logic for inferServerUrl that generates a list of complete url's as candidates for the tests in inferServerUrl. takes an incomplete url as an arg and returns a list of extrapolated full urls.

Parameters:
NameTypeDescription
inputstring
Returns:
Type: 
dynamic

(static) versionChecker(versionToCheck, minVersionAccepted) → {dynamic}

Returns whether or not a version number (e.g. 10.7.7) is greater or equal to some minimum version allowed (e.g. 10.8.0)

Parameters:
NameTypeDescription
versionToCheckstring
minVersionAcceptedstring
Returns:
Type: 
dynamic