@ctrl/plex
    Preparing search index...

    Class PhotoSection

    Base class for a single library section.

    Hierarchy (View Summary)

    Index
    _fieldTypes?: FilteringFieldType[]
    _filterTypes?: FilteringType[]
    agent: string

    Unknown (com.plexapp.agents.imdb, etc)

    allowSync: boolean

    l True if you allow syncing content from this section.

    art: string

    Wallpaper artwork used to respresent this section.

    composite: string

    Composit image used to represent this section.

    CONTENT_TYPE: string = 'photo'
    createdAt: Date

    Datetime this library section was created.

    filters: boolean

    Unknown

    key: string

    plex relative url

    language: string

    Language represented in this section (en, xn, etc).

    locations: Location[]

    Paths on disk where section content is stored.

    METADATA_TYPE: "photo" = ...

    Default item type used by smart filters in this section.

    parent?: WeakRef<any>

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

    refreshing: boolean

    True if this section is currently being refreshed.

    scannedAt: Date
    scanner: string

    Internal scanner used to find media (Plex Movie Scanner, Plex Premium Music Scanner, etc.)

    SECTION_TYPE: typeof Photoalbum = Photoalbum
    server: PlexServer
    thumb: string

    Thumbnail image used to represent this section.

    title: string

    Title of this section.

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

    Type of content section represents (movie, artist, photo, show).

    updatedAt: Date

    Datetime this library section was last updated.

    uuid: string

    Unique id for this section (32258d7c-3e6c-4ac5-98ad-bad7a3b78c63)

    ALLOWED_FILTERS: string[] = ...
    ALLOWED_SORT: string[] = ...
    BOOLEAN_FILTERS: string[] = ...
    TAG: string = 'Directory'

    xml element tag

    TYPE: string = 'photo'

    xml element type

    • Returns photo library items.

      Photo sections default to albums to match Plex's photo library behavior. Pass libtype: 'photo' to return individual photos instead.

      Type Parameters

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

      Parameters

      • options: Omit<Partial<SearchArgs>, "maxresults" | "libtype"> & {
            libtype?:
                | "track"
                | "artist"
                | "album"
                | "movie"
                | "show"
                | "season"
                | "episode"
                | "trailer"
                | "comic"
                | "person"
                | "picture"
                | "clip"
                | "photo"
                | "photoalbum"
                | "playlist"
                | "playlistFolder"
                | "collection"
                | "optimizedVersion"
                | "userPlaylistItem";
            maxResults?: number;
        } & { libtype: T }
        • Optionallibtype?:
              | "track"
              | "artist"
              | "album"
              | "movie"
              | "show"
              | "season"
              | "episode"
              | "trailer"
              | "comic"
              | "person"
              | "picture"
              | "clip"
              | "photo"
              | "photoalbum"
              | "playlist"
              | "playlistFolder"
              | "collection"
              | "optimizedVersion"
              | "userPlaylistItem"

          Return a specific library item type instead of the section default.

          Passing this narrows section.all({ libtype }) to the matching model type.

        • OptionalmaxResults?: number

          Maximum number of items to return.

          Plex may ignore the container size hint on some endpoints, so this method also applies the limit locally before returning.

        • libtype: T

      Returns Promise<SearchClassForLibtype<T>[]>

      const albums = await photoSection.all()
      const photos = await photoSection.all({ libtype: 'photo', maxResults: 50 })
    • Returns photo library items.

      Photo sections default to albums to match Plex's photo library behavior. Pass libtype: 'photo' to return individual photos instead.

      Returns Promise<Photoalbum[]>

      const albums = await photoSection.all()
      const photos = await photoSection.all({ libtype: 'photo', maxResults: 50 })
    • Returns photo library items.

      Photo sections default to albums to match Plex's photo library behavior. Pass libtype: 'photo' to return individual photos instead.

      Parameters

      Returns Promise<LibrarySearchItem[]>

      const albums = await photoSection.all()
      const photos = await photoSection.all({ libtype: 'photo', maxResults: 50 })
    • Run an analysis on all of the items in this library section. See :func:~plexapi.base.PlexPartialObject.analyze for more details.

      Returns Promise<void>

    • Build and validate a server-side search key for smart playlists and collections. Local-only filters are rejected because Plex cannot persist them in a smart filter.

      Parameters

      Returns Promise<string>

    • Delete the preview thumbnails for items in this library. This cannot be undone. Recreating media preview files can take hours or even days.

      Returns Promise<void>

    • Returns one item by exact title, optionally narrowed with normal search filters.

      Use filters to disambiguate duplicate titles. When libtype is provided, the returned item is typed to that Plex model.

      Type Parameters

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

      Parameters

      • options: Omit<Partial<SearchArgs>, "limit" | "title" | "maxresults" | "libtype"> & {
            libtype?:
                | "track"
                | "artist"
                | "album"
                | "movie"
                | "show"
                | "season"
                | "episode"
                | "trailer"
                | "comic"
                | "person"
                | "picture"
                | "clip"
                | "photo"
                | "photoalbum"
                | "playlist"
                | "playlistFolder"
                | "collection"
                | "optimizedVersion"
                | "userPlaylistItem";
            title: string;
        } & { libtype: T }
        • Optionallibtype?:
              | "track"
              | "artist"
              | "album"
              | "movie"
              | "show"
              | "season"
              | "episode"
              | "trailer"
              | "comic"
              | "person"
              | "picture"
              | "clip"
              | "photo"
              | "photoalbum"
              | "playlist"
              | "playlistFolder"
              | "collection"
              | "optimizedVersion"
              | "userPlaylistItem"

          Return a specific Plex item type instead of the section default.

        • title: string

          Exact item title to return.

        • libtype: T

      Returns Promise<SearchClassForLibtype<T>>

      const movie = await movieSection.get({ title: 'Big Buck Bunny', year: 2008 })
      const episode = await showSection.get({ title: 'Minimum Viable Product', libtype: 'episode' })
    • Returns one item by exact title, optionally narrowed with normal search filters.

      Use filters to disambiguate duplicate titles. When libtype is provided, the returned item is typed to that Plex model.

      Parameters

      Returns Promise<Photoalbum>

      const movie = await movieSection.get({ title: 'Big Buck Bunny', year: 2008 })
      const episode = await showSection.get({ title: 'Minimum Viable Product', libtype: 'episode' })
    • Parameters

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

      Returns Promise<FilteringType>

    • Returns the media item with the specified external IMDB, TMDB, or TVDB ID. Note: This search uses a PlexAPI operator so performance may be slow. All items from the entire Plex library need to be retrieved for each guid search. It is recommended to create your own lookup dictionary if you are searching for a lot of external guids.

      Parameters

      • guid: string

        The external guid of the item to return. Examples: IMDB imdb://tt0944947, TMDB tmdb://1399, TVDB tvdb://121361.

        Example:

        	.. code-block:: python
        
        			# This will retrieve all items in the entire library 3 times
        			result1 = library.getGuid('imdb://tt0944947')
        			result2 = library.getGuid('tmdb://1399')
        			result3 = library.getGuid('tvdb://121361')
        
        			# This will only retrieve all items in the library once to create a lookup dictionary
        			guidLookup = {guid.id: item for item in library.all() for guid in item.guids}
        			result1 = guidLookup['imdb://tt0944947']
        			result2 = guidLookup['tmdb://1399']
        			result3 = guidLookup['tvdb://121361']
        

      Returns Promise<Photoalbum>

    • Returns the Plex Web URL for the library.

      Parameters

      • base: { base?: string; key?: string; tab?: string } = {}

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

        • Optionalbase?: string

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

        • Optionalkey?: string

          A hub key.

        • Optionaltab?: string

          The library tab (recommended, library, collections, playlists, timeline).

      Returns string

    • Returns a list of available FilteringField for a specified libtype. This is the list of options in the custom filter dropdown menu

      Parameters

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

      Returns Promise<FilteringField[]>

    • Returns the available values for a custom filter field.

      Parameters

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

      Returns Promise<FilterChoice[]>

    • Parameters

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

        The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).

      Returns Promise<FilteringFilter[]>

      const availableFilters = (await library.listFilters()).map(f => f.filter)
      
    • Returns a list of available sorting fields for the specified libtype.

      Parameters

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

      Returns Promise<FilteringSort[]>

    • Lock a field for all items of a libtype in this library.

      Parameters

      • field: string
      • libtype:
            | "track"
            | "artist"
            | "album"
            | "movie"
            | "show"
            | "season"
            | "episode"
            | "trailer"
            | "comic"
            | "person"
            | "picture"
            | "clip"
            | "photo"
            | "photoalbum"
            | "playlist"
            | "playlistFolder"
            | "collection"
            | "optimizedVersion"
            | "userPlaylistItem" = ...

      Returns Promise<PhotoSection>

    • Returns recently added photo albums from this library section.

      Parameters

      • maxResults: number = 50

      Returns Promise<Photoalbum[]>

    • Returns recently added photos from this library section.

      Parameters

      • maxResults: number = 50

      Returns Promise<Photo[]>

    • Forces a download of fresh media information from the internet. This can take a long time. Any locked fields are not modified.

      Returns Promise<void>

    • Search the library. The http requests will be batched in container_size. If you are only looking for the first results, it would be wise to set the maxresults option to that amount so the search doesn't iterate over all results on the server.

      Example: "studio=Comedy%20Central" or "year=1999" "title=Kung Fu" all work. Other items such as actor= seem to work, but require you already know the id of the actor. TLDR: This is untested but seems to work. Use library section search when you can.

      Type Parameters

      Parameters

      • args: Partial<SearchArgs> = {}

        Search using a number of different attributes

      • OptionalCls: Class<C>

      Returns Promise<C[]>

    • Returns the total number of items in the library. Queries the library without fetching any items to get the total count.

      Parameters

      • Optionaloptions: { includeCollections?: boolean; libtype?: string }
        • OptionalincludeCollections?: boolean

          Whether to include collections in the count. Default true.

        • Optionallibtype?: string

          Filter by a specific library type (movie, show, episode, etc.).

      Returns Promise<number>

    • Unlock a field for all items of a libtype in this library.

      Parameters

      • field: string
      • libtype:
            | "track"
            | "artist"
            | "album"
            | "movie"
            | "show"
            | "season"
            | "episode"
            | "trailer"
            | "comic"
            | "person"
            | "picture"
            | "clip"
            | "photo"
            | "photoalbum"
            | "playlist"
            | "playlistFolder"
            | "collection"
            | "optimizedVersion"
            | "userPlaylistItem" = ...

      Returns Promise<PhotoSection>