Class PlexServer

This is the main entry point to interacting with a Plex server. It allows you to list connected clients, browse your library sections and perform actions such as emptying trash. If you do not know the auth token required to access your Plex server, or simply want to access your server with your username and password, you can also create an PlexServer instance from :class:~plexapi.myplex.MyPlexAccount.

Constructors

  • Parameters

    • baseurl: string
    • token: string
    • timeout: number = TIMEOUT

      Default request timeout in milliseconds.

      30000
      

    Returns PlexServer

Properties

_library?: Library
_settings?: Settings
allowCameraUpload: boolean

True if server allows camera upload

allowChannelAccess: boolean

True if server allows channel access (iTunes?)

allowMediaDeletion: boolean

True is server allows media to be deleted.

allowSharing: boolean

True is server allows sharing

allowSync: boolean

True is server allows sync

allowTuners: boolean

Unknown

backgroundProcessing: boolean

Unknown

baseurl: string
certificate: boolean

True if server has an HTTPS certificate

companionProxy: boolean

Unknown

diagnostics: string

Unknown

eventStream: boolean

Unknown

friendlyName: string

Human friendly name for this server

hubSearch: boolean

True if Hub Search <https!://www.plex.tv/blog /seek-plex-shall-find-leveling-web-app/>_ is enabled. I believe this is enabled for everyone

key: string = '/'
livetv: number

Unknown

machineIdentifier?: string

Unique ID for this server (looks like an md5)

multiuser: boolean

True if multiusers <https!://support.plex.tv/hc/en-us/articles/200250367-Multi-User-Support>_ are enabled.

myPlex: boolean

Unknown (True if logged into myPlex?)

myPlexMappingState: string

Unknown (ex!: mapped)

myPlexSigninState: string

Unknown (ex!: ok).

myPlexSubscription: boolean

True if you have a myPlex subscription

myPlexUsername: string

Email address if signed into myPlex (user@example.com)

ownerFeatures: string[]

List of features allowed by the server owner. This may be based on your PlexPass subscription. Features include!: camera_upload, cloudsync, content_filter, dvr, hardware_transcoding, home, lyrics, music_videos, pass, photo_autotags, premium_music_metadata, session_bandwidth_restrictions, sync, trailers, webhooks (and maybe more).

photoAutoTag: boolean

True if photo auto-tagging <https!://support.plex.tv/hc/en-us/articles/234976627-Auto-Tagging-of-Photos>_ is enabled.

platform: string

Platform the server is hosted on (ex!: Linux)

platformVersion: string

Platform version (ex!: '6.1 (Build 7601)', '4.4.0-59-generic').

pluginHost: boolean

Unknown

pushNotifications: boolean

Unknown

readOnlyLibraries: boolean

Unknown

requestParametersInCookie: boolean

Unknown

streamingBrainABRVersion: number
streamingBrainVersion: number

Current Streaming Brain <https!://www.plex.tv/blog/mcstreamy-brain-take-world-two-easy-steps/>_ version.

sync: boolean

True if syncing to a device <https!://support.plex.tv/hc/en-us/articles/201053678-Sync-Media-to-a-Device>_ is enabled.

timeout: number = TIMEOUT

Default request timeout in milliseconds.

30000
token: string
transcoderActiveVideoSessions: number

Number of active video transcoding sessions.

transcoderAudio: boolean

True if audio transcoding audio is available.

transcoderLyrics: boolean

True if audio transcoding lyrics is available.

transcoderPhoto: boolean

True if audio transcoding photos is available.

transcoderSubtitles: boolean

True if audio transcoding subtitles is available.

transcoderVideo: boolean

True if audio transcoding video is available.

transcoderVideoBitrates: string

List of video bitrates.

transcoderVideoQualities: string

List of video qualities.

transcoderVideoResolutions: string

List of video resolutions.

updatedAt: number

Datetime the server was updated.

updater: boolean

Unknown

version: string

Current Plex version (ex!: 1.3.2.3112-1751929)

voiceSearch: boolean

True if voice search is enabled. (is this Google Voice search?)

Methods

  • Build the Plex Web URL for the object.

    Parameters

    • base: string = 'https://app.plex.tv/desktop/'

      The base URL before the fragment (#!). Default is https://app.plex.tv/desktop.

    • Optionalendpoint: string

      The Plex Web URL endpoint. None for server, 'playlist' for playlists, 'details' for all other media types.

    • Optionalparams: URLSearchParams

    Returns string

  • Returns string

  • Parameters

    • OptionalmediaType: string | number

    Returns Promise<Agent[]>

  • Returns Promise<void>

  • Returns a list of media items from watched history. If there are many results, they will be fetched from the server in batches of X_PLEX_CONTAINER_SIZE amounts. If you're only looking for the first results, it would be wise to set the maxresults option to that amount so this functions doesn't iterate over all results on the server.

    Parameters

    • maxresults: number = 9999999

      Only return the specified number of results (optional).

    • Optionalmindate: Date

      Min datetime to return results from. This really helps speed up the result listing. For example: datetime.now() - timedelta(days=7)

    • OptionalratingKey: string | number

      request history for a specific ratingKey item.

    • OptionalaccountId: string | number

      request history for a specific account ID.

    • OptionallibrarySectionId: string | number

      request history for a specific library section ID.

    Returns Promise<HistoryMetadatum[]>

  • Library to browse or search your media.

    Returns Promise<Library>

  • Returns a :class:~plexapi.myplex.MyPlexAccount object using the same token to access this server. If you are not the owner of this PlexServer you're likley to recieve an authentication error calling this.

    Returns MyPlexAccount

  • Returns list of all :class:~plexapi.media.Optimized objects connected to server.

    Returns Promise<Optimized[]>

  • Main method used to handle HTTPS requests to the Plex server. This method helps by encoding the response to utf-8 and parsing the returned XML into and ElementTree object. Returns None if no data exists in the response. TODO: use headers

    Type Parameters

    • T = any

    Parameters

    • path: string
    • method:
          | "get"
          | "post"
          | "put"
          | "patch"
          | "head"
          | "delete" = 'get'
    • options: {
          body?: Uint8Array;
          headers?: Record<string, string>;
      } = {}
      • Optionalbody?: Uint8Array
      • Optionalheaders?: Record<string, string>
    • Optionalusername: string
    • Optionalpassword: string

    Returns Promise<T>

  • Returns a list of media items or filter categories from the resulting Hub Search <https://www.plex.tv/blog/seek-plex-shall-find-leveling-web-app/>_ against all items in your Plex library. This searches genres, actors, directors, playlists, as well as all the obvious media titles. It performs spell-checking against your search terms (because KUROSAWA is hard to spell). It also provides contextual search results. So for example, if you search for 'Pernice', it’ll return 'Pernice Brothers' as the artist result, but we’ll also go ahead and return your most-listened to albums and tracks from the artist. If you type 'Arnold' you’ll get a result for the actor, but also the most recently added movies he’s in.

    Parameters

    • query: string

      Query to use when searching your library.

    • Optionalmediatype:
          | "movie"
          | "show"
          | "season"
          | "episode"
          | "trailer"
          | "comic"
          | "person"
          | "artist"
          | "album"
          | "track"
          | "picture"
          | "clip"
          | "photo"
          | "photoalbum"
          | "playlist"
          | "playlistFolder"
          | "collection"
          | "optimizedVersion"
          | "userPlaylistItem"

      Optionally limit your search to the specified media type.

    • Optionallimit: number

      Optionally limit to the specified number of results per Hub.

    Returns Promise<Hub[]>

  • Returns Promise<Settings>

  • Build a URL string with proper token argument. Token will be appended to the URL if either includeToken is True or TODO: CONFIG.log.show_secrets is 'true'.

    Parameters

    • key: string
    • includeToken: boolean = false
    • Optionalparams: URLSearchParams

    Returns URL