@ctrl/plex
    Preparing search index...

    Class Track

    Represents a single Track.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • server: PlexServer
      • data: any
      • initpath: string
      • parent: PlexObject

      Returns Track

    Properties

    _INCLUDES: {
        checkFiles: number;
        includeAllConcerts: number;
        includeBandwidths: number;
        includeChapters: number;
        includeChildren: number;
        includeConcerts: number;
        includeExternalMedia: number;
        includeExtras: number;
        includeFields: string;
        includeGeolocation: number;
        includeLoudnessRamps: number;
        includeMarkers: number;
        includeOnDeck: number;
        includePopularLeaves: number;
        includePreferences: number;
        includeRelated: number;
        includeRelatedCount: number;
        includeReviews: number;
        includeStations: number;
    } = ...
    addedAt?: Date
    art?: string
    artBlurHash?: string
    audienceRating?: number
    chapters?: Chapter[]
    chapterSource?: string
    collections?: Collection[]
    distance?: number

    Sonic distance from a seed item, used in sonically similar results.

    duration?: number
    fields?: Field[]

    List of field objects.

    genres?: Genre[]
    grandparentArt?: string
    grandparentGuid?: string
    grandparentKey?: string
    grandparentRatingKey?: number
    grandparentTheme?: string
    grandparentThumb?: string
    grandparentTitle?: string
    guid?: string
    guids?: Guid[]
    images?: Image[]

    List of image objects.

    index?: number

    Plex index number (often the track number for tracks).

    key: string

    plex relative url

    labels?: Label[]
    lastRatedAt?: Date
    lastViewedAt?: Date
    librarySectionID?: number
    librarySectionKey?: string

    Key of the library section this item belongs to.

    librarySectionTitle?: string

    Title of the library section this item belongs to.

    media?: Media[]
    moods?: Mood[]

    List of mood objects.

    musicAnalysisVersion?: number

    Plex music analysis version (1 indicates sonic analysis complete).

    originalTitle?: string
    parent?: WeakRef<any>

    WeakRef to the parent object that this object is built from.

    parentGuid?: string
    parentIndex?: number
    parentKey?: string
    parentRatingKey?: number
    parentThumb?: string
    parentTitle?: string
    primaryExtraKey?: string
    rating?: number
    ratingKey?: string
    server: PlexServer
    skipCount?: number
    sourceURI?: string
    summary?: string
    thumb?: string
    thumbBlurHash?: string
    title?: string
    titleSort?: string

    Title used for sorting (defaults to title).

    type?: string
    updatedAt?: Date
    userRating?: number

    User rating (0.0-10.0).

    viewCount?: number

    Count of times the item was played.

    viewOffset?: number
    year?: number
    METADATA_TYPE: string = 'track'

    Default metadata type for audio sync items.

    TAG: string = 'Track'

    xml element tag

    TYPE: string = 'track'

    xml element type

    Accessors

    • get hasSonicAnalysis(): boolean

      Indicates if the audio item has undergone sonic analysis.

      Returns boolean

    • get isFullObject(): boolean

      Retruns True if this is already a full object. A full object means all attributes were populated from the api path representing only this item. For example, the search result for a movie often only contain a portion of the attributes a full object (main url) for that movie would contain.

      Returns boolean

    • get listType(): "audio"

      Hardcoded list type for filtering.

      Returns "audio"

    • get locations(): string[]

      Returns string[]

      List of file paths where the track is found on disk.

    • get trackNumber(): number

      Returns number

      The track number.

    Methods

    • Returns string

      Default title for a new syncItem.

    • Add a collection(s).

      Parameters

      • collections: string[]

      Returns Promise<void>

    • Add a genre(s).

      Parameters

      • genres: string[]

      Returns Promise<void>

    • Add a label(s).

      Parameters

      • labels: string[]

      Returns Promise<void>

    • Return the track's Album.

      Returns Promise<Album>

    • Tell Plex Media Server to performs analysis on it this item to gather information. Analysis includes:

      • Gather Media Properties: All of the media you add to a Library has properties that are useful to know–whether it's a video file, a music track, or one of your photos (container, codec, resolution, etc).
      • Generate Default Artwork: Artwork will automatically be grabbed from a video file. A background image will be pulled out as well as a smaller image to be used for poster/thumbnail type purposes.
      • Generate Video Preview Thumbnails: Video preview thumbnails are created, if you have that feature enabled. Video preview thumbnails allow graphical seeking in some Apps. It's also used in the Plex Web App Now Playing screen to show a graphical representation of where playback is. Video preview thumbnails creation is a CPU-intensive process akin to transcoding the file.
      • Generate intro video markers: Detects show intros, exposing the 'Skip Intro' button in clients.

      Returns Promise<void>

    • Return the track's Artist.

      Returns Promise<Artist>

    • Delete a media element. This has to be enabled under settings > server > library in plex webui.

      Returns Promise<any>

    • Edit an object.

      Parameters

      • changeObj: Record<string, string | number>

        Obj of settings to edit. Example: {'type': 1, 'id': movie.ratingKey, 'title.value': 'New Title', 'collection[0].tag.tag': 'Super', 'collection.locked': 0}

      Returns Promise<void>

    • Use match result to update show metadata.

      Parameters

      • OptionalsearchResult: SearchResult

        Search result

      • auto: boolean = false

        True uses first match from matches, False allows user to provide the match

      • agent: string = ''

        (str): Agent name to be used (imdb, thetvdb, themoviedb, etc.)

      Returns Promise<void>

    • Returns the Plex Web URL pointing to the album details page for this track.

      Parameters

      • Optionalbase: string

      Returns string

    • Get Play History for a media item.

      Parameters

      • maxresults: number = 9999999

        Only return the specified number of results (optional).

      • Optionalmindate: Date

        Min datetime to return results from.

      Returns Promise<HistoryMetadatum[]>

    • Returns True if this object is a child of the given class.

      Parameters

      • cls: any

      Returns boolean

    • Parameters

      • Optionalagent: string

        Agent name to be used (imdb, thetvdb, themoviedb, etc.)

      • Optionaltitle: string

        Title of item to search for

      • Optionalyear: string

        Year of item to search in

      • Optionallanguage: string

        Language of item to search in

        Examples:

        1. video.matches()

        2. video.matches(title="something", year=2020)

        3. video.matches(title="something")

        4. video.matches(year=2020)

        5. video.matches(title="something", year="")

        6. video.matches(title="", year=2020)

        7. video.matches(title="", year="")

        8. The default behaviour in Plex Web = no params in plexapi

        9. Both title and year specified by user

        10. Year automatically filled in

        11. Title automatically filled in

        12. Explicitly searches for title with blank year

        13. Explicitly searches for blank title with year

        14. I don't know what the user is thinking... return the same result as 1

        For 2 to 7, the agent and language is automatically filled in

      Returns Promise<SearchResult[]>

    • Returns string

      A filename for use in download.

    • Refreshing a Library or individual item causes the metadata for the item to be refreshed, even if it already has metadata. You can think of refreshing as "update metadata for the requested item even if it already has some". You should refresh a Library or individual item if:

      Returns Promise<void>

    • load full data / reload the data for this object from this.key.

      Parameters

      • Optionalekey: string
      • Optionalargs: any

      Returns Promise<void>

    • Remove a collection(s).

      Parameters

      • collections: string[]

      Returns Promise<void>

    • Remove a genre(s).

      Parameters

      • genres: string[]

      Returns Promise<void>

    • Remove a label(s).

      Parameters

      • labels: string[]

      Returns Promise<void>

    • Returns a sonic adventure from the current track to the specified track.

      Parameters

      • to: Track

        The target track for the sonic adventure.

      Returns Promise<Track[]>

    • Fetches a list of sonically similar audio items from the Plex server. The returned items will be instances of the same class as the current item (e.g., calling sonicallySimilar on a Track instance returns Track[]).

      Parameters

      • Optionallimit: number

        Maximum number of similar items to return. Server default is 50.

      • OptionalmaxDistance: number

        Maximum sonic distance (0.0 - 1.0) between items. Server default is 0.25.

      • Optionaloptions: Record<string, string | number>

        Optional additional filters to apply to the results.

      Returns Promise<Audio[]>

      A promise resolving to an array of sonically similar Audio items.

    • Unmatches metadata match from object.

      Returns Promise<any>

    • Returns the full URL for a given part (like a media stream) relative to the item's key. Includes the authentication token.

      Parameters

      • part: string

        The relative path or resource identifier.

      Returns string

      The full URL string including the server address and token, or undefined if part is empty.