Methods

(static) formatAudioChannels(channels) → {string}

formatAudioChannels: Convert channel count integer to display format Ignores ChannelLayout field since it can return inconsistent strings (e.g., "stereo")

Parameters:
NameTypeDescription
channelsinteger

Number of audio channels

Returns:
  • Channel layout string (e.g., "2.0", "5.1", "7.1") or "" if invalid/zero
Type: 
string

(static) formatAudioDisplayTitle(stream) → {string}

formatAudioDisplayTitle: Build a display title for an audio stream Format: "Language CODEC CHANNELS" or "Language CODEC CHANNELS (default)"

Parameters:
NameTypeDescription
streamobject

Audio MediaStream object from Jellyfin API

Returns:
  • Formatted display title (e.g., "English AAC 2.0 (default)") or "N/A" if insufficient data
Type: 
string

(static) formatSubtitleDisplayTitle(stream) → {string}

formatSubtitleDisplayTitle: Build a display title for a subtitle stream Format: "Language CODEC", "Language CODEC (forced)", or "Language CODEC (default)" Forced takes precedence over default if both are set.

Parameters:
NameTypeDescription
streamobject

Subtitle MediaStream object from Jellyfin API

Returns:
  • Formatted display title (e.g., "English SUBRIP (forced)") or "N/A" if insufficient data
Type: 
string

(static) formatVideoDisplayTitle(stream) → {string}

formatVideoDisplayTitle: Build a display title for a video stream Format: "RESOLUTION CODEC" or "RESOLUTION CODEC RANGETYPE" (when HDR)

Parameters:
NameTypeDescription
streamobject

Video MediaStream object from Jellyfin API

Returns:
  • Formatted display title (e.g., "4K HEVC HDR10") or "N/A" if insufficient data
Type: 
string

(static) formatVideoSourceTitle(mediaSource, hasMultipleSources) → {string}

formatVideoSourceTitle: Build a display title for a video source (MediaSource) Finds the first video stream and formats it via formatVideoDisplayTitle(). When multiple sources exist (i.e., multiple versions of the same video), prepends the source Name (e.g., "[B&W] 1080p H264").

Parameters:
NameTypeDescription
mediaSourceobject

A MediaSource object from Jellyfin API (must have mediaStreams array)

hasMultipleSourcesboolean

True when item has more than one MediaSource version

Returns:
  • Formatted display title (e.g., "[B&W] 1080p H264") or "N/A" if no video stream found
Type: 
string

(static) getVideoResolutionLabel(width, height, isInterlaced) → {string}

getVideoResolutionLabel: Determine resolution label from video dimensions Resolution thresholds check width OR height (either can qualify) 4K never gets p/i suffix. All other resolutions get "p" or "i" based on interlacing.

Parameters:
NameTypeDescription
widthinteger

Video width in pixels

heightinteger

Video height in pixels

isInterlacedboolean

Whether the video is interlaced

Returns:
  • Resolution label (e.g., "4K", "1080p", "720i") or "" if below all thresholds
Type: 
string

(static) resolveLanguageName(langCode) → {string}

resolveLanguageName: Convert a media stream language code to a localized display name.

MediaStream.Language passes through whatever the container metadata holds — ffmpeg/Jellyfin do not normalize, so real-world inputs include ISO 639-2/T ("fra"), 639-2/B ("fre"), 639-1 ("fr"), and BCP-47 tags ("fr-FR", "pt_BR").

Three-tier resolution chain:

  1. Lowercase + strip after first "-" or "_" (drop region/script suffix)
  2. "und" / "zxx" → "" — caller omits the language label
  3. Alias map → normalize 3-letter / deprecated codes to a base form
  4. Tier 1: translationKey lookup → translate() — localized to user's UI
  5. Tier 2: English-name fallback → covers every other ISO 639-2 code
  6. Tier 3: raw code passthrough — last-resort, preserves info

"und" (Undefined) and "zxx" (No linguistic content — instrumental music, ambient sound, foley) are both omitted: rendering "No linguistic content EAC3 5.1" as a track label is noisier than just "EAC3 5.1". The other ISO 639-2 special codes ("mul" Multiple, "mis" Uncoded) ARE displayed because they convey real information when they appear.

Parameters:
NameTypeDescription
langCodestring

Media stream language code from any common format

Returns:
  • Localized name, English fallback, "" for und/zxx, or raw code
Type: 
string