Photo plexapi.photo

class plexapi.photo.Photoalbum(server, data, initpath=None, parent=None)[source]

Bases: plexapi.base.PlexPartialObject, plexapi.mixins.RatingMixin, plexapi.mixins.ArtMixin, plexapi.mixins.PosterMixin, plexapi.mixins.SortTitleMixin, plexapi.mixins.SummaryMixin, plexapi.mixins.TitleMixin

Represents a single Photoalbum (collection of photos).

Variables
  • TAG (str) – ‘Directory’

  • TYPE (str) – ‘photo’

  • addedAt (datetime) – Datetime the photo album was added to the library.

  • art (str) – URL to artwork image (/library/metadata/<ratingKey>/art/<artid>).

  • composite (str) – URL to composite image (/library/metadata/<ratingKey>/composite/<compositeid>)

  • fields (List<Field>) – List of field objects.

  • guid (str) – Plex GUID for the photo album (local://229674).

  • index (sting) – Plex index number for the photo album.

  • key (str) – API URL (/library/metadata/<ratingkey>).

  • lastRatedAt (datetime) – Datetime the photo album was last rated.

  • librarySectionID (int) – LibrarySection ID.

  • librarySectionKey (str) – LibrarySection key.

  • librarySectionTitle (str) – LibrarySection title.

  • listType (str) – Hardcoded as ‘photo’ (useful for search filters).

  • ratingKey (int) – Unique key identifying the photo album.

  • summary (str) – Summary of the photoalbum.

  • thumb (str) – URL to thumbnail image (/library/metadata/<ratingKey>/thumb/<thumbid>).

  • title (str) – Name of the photo album. (Trip to Disney World)

  • titleSort (str) – Title to use when sorting (defaults to title).

  • type (str) – ‘photo’

  • updatedAt (datetime) – Datetime the photo album was updated.

  • userRating (float) – Rating of the photo album (0.0 - 10.0) equaling (0 stars - 5 stars).

album(title)[source]

Returns the Photoalbum that matches the specified title.

Parameters

title (str) – Title of the photo album to return.

albums(**kwargs)[source]

Returns a list of Photoalbum objects in the album.

photo(title)[source]

Returns the Photo that matches the specified title.

Parameters

title (str) – Title of the photo to return.

photos(**kwargs)[source]

Returns a list of Photo objects in the album.

clip(title)[source]

Returns the Clip that matches the specified title.

Parameters

title (str) – Title of the clip to return.

clips(**kwargs)[source]

Returns a list of Clip objects in the album.

get(title)[source]

Alias to photo().

download(savepath=None, keep_original_name=False, subfolders=False)[source]

Download all photos and clips from the photo album. See download() for details.

Parameters
  • savepath (str) – Defaults to current working dir.

  • keep_original_name (bool) – True to keep the original filename otherwise a friendlier filename is generated.

  • subfolders (bool) – True to separate photos/clips in to photo album folders.

class plexapi.photo.Photo(server, data, initpath=None, parent=None)[source]

Bases: plexapi.base.PlexPartialObject, plexapi.base.Playable, plexapi.mixins.RatingMixin, plexapi.mixins.ArtUrlMixin, plexapi.mixins.PosterUrlMixin, plexapi.mixins.PhotoCapturedTimeMixin, plexapi.mixins.SortTitleMixin, plexapi.mixins.SummaryMixin, plexapi.mixins.TitleMixin, plexapi.mixins.TagMixin

Represents a single Photo.

Variables
  • TAG (str) – ‘Photo’

  • TYPE (str) – ‘photo’

  • addedAt (datetime) – Datetime the photo was added to the library.

  • createdAtAccuracy (str) – Unknown (local).

  • createdAtTZOffset (int) – Unknown (-25200).

  • fields (List<Field>) – List of field objects.

  • guid (str) – Plex GUID for the photo (com.plexapp.agents.none://231714?lang=xn).

  • index (sting) – Plex index number for the photo.

  • key (str) – API URL (/library/metadata/<ratingkey>).

  • lastRatedAt (datetime) – Datetime the photo was last rated.

  • librarySectionID (int) – LibrarySection ID.

  • librarySectionKey (str) – LibrarySection key.

  • librarySectionTitle (str) – LibrarySection title.

  • listType (str) – Hardcoded as ‘photo’ (useful for search filters).

  • media (List<Media>) – List of media objects.

  • originallyAvailableAt (datetime) – Datetime the photo was added to Plex.

  • parentGuid (str) – Plex GUID for the photo album (local://229674).

  • parentIndex (int) – Plex index number for the photo album.

  • parentKey (str) – API URL of the photo album (/library/metadata/<parentRatingKey>).

  • parentRatingKey (int) – Unique key identifying the photo album.

  • parentThumb (str) – URL to photo album thumbnail image (/library/metadata/<parentRatingKey>/thumb/<thumbid>).

  • parentTitle (str) – Name of the photo album for the photo.

  • ratingKey (int) – Unique key identifying the photo.

  • summary (str) – Summary of the photo.

  • tags (List<Tag>) – List of tag objects.

  • thumb (str) – URL to thumbnail image (/library/metadata/<ratingKey>/thumb/<thumbid>).

  • title (str) – Name of the photo.

  • titleSort (str) – Title to use when sorting (defaults to title).

  • type (str) – ‘photo’

  • updatedAt (datetime) – Datetime the photo was updated.

  • userRating (float) – Rating of the photo (0.0 - 10.0) equaling (0 stars - 5 stars).

  • year (int) – Year the photo was taken.

photoalbum()[source]

Return the photo’s Photoalbum.

section()[source]

Returns the LibrarySection the item belongs to.

property locations

This does not exist in plex xml response but is added to have a common interface to get the locations of the photo.

Returns

List<str> of file paths where the photo is found on disk.

sync(resolution, client=None, clientId=None, limit=None, title=None)[source]

Add current photo as sync item for specified device. See sync() for possible exceptions.

Parameters
  • resolution (str) – maximum allowed resolution for synchronized photos, see PHOTO_QUALITY_* values in the module sync.

  • client (MyPlexDevice) – sync destination, see sync().

  • clientId (str) – sync destination, see sync().

  • limit (int) – maximum count of items to sync, unlimited if None.

  • title (str) – descriptive title for the new SyncItem, if empty the value would be generated from metadata of current photo.

Returns

an instance of created syncItem.

Return type

SyncItem

class plexapi.photo.PhotoSession(server, data, initpath=None, parent=None)[source]

Bases: plexapi.base.PlexSession, plexapi.photo.Photo

Represents a single Photo session loaded from sessions().