Mixins plexapi.mixins

class plexapi.mixins.AdvancedSettingsMixin[source]

Bases: object

Mixin for Plex objects that can have advanced settings.

preferences()[source]

Returns a list of Preferences objects.

preference(pref)[source]

Returns a Preferences object for the specified pref.

Parameters:

pref (str) – The id of the preference to return.

editAdvanced(**kwargs)[source]

Edit a Plex object’s advanced settings.

defaultAdvanced()[source]

Edit all of a Plex object’s advanced settings to default.

class plexapi.mixins.SmartFilterMixin[source]

Bases: object

Mixin for Plex objects that can have smart filters.

class plexapi.mixins.SplitMergeMixin[source]

Bases: object

Mixin for Plex objects that can be split and merged.

split()[source]

Split duplicated Plex object into separate objects.

merge(ratingKeys)[source]

Merge other Plex objects into the current object.

Parameters:

ratingKeys (list) – A list of rating keys to merge.

class plexapi.mixins.UnmatchMatchMixin[source]

Bases: object

Mixin for Plex objects that can be unmatched and matched.

unmatch()[source]

Unmatches metadata match from object.

matches(agent=None, title=None, year=None, language=None)[source]

Return list of (SearchResult) metadata matches.

Parameters:

agent (str): Agent name to be used (imdb, thetvdb, themoviedb, etc.) title (str): Title of item to search for year (str): Year of item to search in language (str) : 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=””)

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

  2. Both title and year specified by user

  3. Year automatically filled in

  4. Title automatically filled in

  5. Explicitly searches for title with blank year

  6. Explicitly searches for blank title with year

  7. 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

fixMatch(searchResult=None, auto=False, agent=None)[source]

Use match result to update show metadata.

Parameters:
  • auto (bool) – True uses first match from matches False allows user to provide the match

  • searchResult (SearchResult) – Search result from ~plexapi.base.matches()

  • agent (str) – Agent name to be used (imdb, thetvdb, themoviedb, etc.)

class plexapi.mixins.ExtrasMixin[source]

Bases: object

Mixin for Plex objects that can have extras.

extras()[source]

Returns a list of Extra objects.

class plexapi.mixins.HubsMixin[source]

Bases: object

Mixin for Plex objects that can have related hubs.

hubs()[source]

Returns a list of Hub objects.

class plexapi.mixins.PlayedUnplayedMixin[source]

Bases: object

Mixin for Plex objects that can be marked played and unplayed.

property isPlayed

Returns True if this video is played.

markPlayed()[source]

Mark the Plex object as played.

markUnplayed()[source]

Mark the Plex object as unplayed.

property isWatched

Alias to self.isPlayed.

markWatched()[source]

Alias to markPlayed().

markUnwatched()[source]

Alias to markUnplayed().

class plexapi.mixins.RatingMixin[source]

Bases: object

Mixin for Plex objects that can have user star ratings.

rate(rating=None)[source]

Rate the Plex object. Note: Plex ratings are displayed out of 5 stars (e.g. rating 7.0 = 3.5 stars).

Parameters:

rating (float, optional) – Rating from 0 to 10. Exclude to reset the rating.

Raises:

BadRequest – If the rating is invalid.

class plexapi.mixins.ArtUrlMixin[source]

Bases: object

Mixin for Plex objects that can have a background artwork url.

property artUrl

Return the art url for the Plex object.

class plexapi.mixins.ArtLockMixin[source]

Bases: object

Mixin for Plex objects that can have a locked background artwork.

lockArt()[source]

Lock the background artwork for a Plex object.

unlockArt()[source]

Unlock the background artwork for a Plex object.

class plexapi.mixins.ArtMixin[source]

Bases: ArtUrlMixin, ArtLockMixin

Mixin for Plex objects that can have background artwork.

arts()[source]

Returns list of available Art objects.

uploadArt(url=None, filepath=None)[source]

Upload a background artwork from a url or filepath.

Parameters:
  • url (str) – The full URL to the image to upload.

  • filepath (str) – The full file path the the image to upload or file-like object.

setArt(art)[source]

Set the background artwork for a Plex object.

Parameters:

art (Art) – The art object to select.

class plexapi.mixins.PosterUrlMixin[source]

Bases: object

Mixin for Plex objects that can have a poster url.

property thumbUrl

Return the thumb url for the Plex object.

property posterUrl

Alias to self.thumbUrl.

class plexapi.mixins.PosterLockMixin[source]

Bases: object

Mixin for Plex objects that can have a locked poster.

lockPoster()[source]

Lock the poster for a Plex object.

unlockPoster()[source]

Unlock the poster for a Plex object.

class plexapi.mixins.PosterMixin[source]

Bases: PosterUrlMixin, PosterLockMixin

Mixin for Plex objects that can have posters.

posters()[source]

Returns list of available Poster objects.

uploadPoster(url=None, filepath=None)[source]

Upload a poster from a url or filepath.

Parameters:
  • url (str) – The full URL to the image to upload.

  • filepath (str) – The full file path the the image to upload or file-like object.

setPoster(poster)[source]

Set the poster for a Plex object.

Parameters:

poster (Poster) – The poster object to select.

class plexapi.mixins.ThemeUrlMixin[source]

Bases: object

Mixin for Plex objects that can have a theme url.

property themeUrl

Return the theme url for the Plex object.

class plexapi.mixins.ThemeLockMixin[source]

Bases: object

Mixin for Plex objects that can have a locked theme.

lockTheme()[source]

Lock the theme for a Plex object.

unlockTheme()[source]

Unlock the theme for a Plex object.

class plexapi.mixins.ThemeMixin[source]

Bases: ThemeUrlMixin, ThemeLockMixin

Mixin for Plex objects that can have themes.

themes()[source]

Returns list of available Theme objects.

uploadTheme(url=None, filepath=None, timeout=None)[source]

Upload a theme from url or filepath.

Warning: Themes cannot be deleted using PlexAPI!

Parameters:
  • url (str) – The full URL to the theme to upload.

  • filepath (str) – The full file path to the theme to upload or file-like object.

  • timeout (int, optional) – Timeout, in seconds, to use when uploading themes to the server. (default config.TIMEOUT).

class plexapi.mixins.EditFieldMixin[source]

Bases: object

Mixin for editing Plex object fields.

editField(field, value, locked=True, **kwargs)[source]

Edit the field of a Plex object. All field editing methods can be chained together. Also see batchEdits() for batch editing fields.

Parameters:
  • field (str) – The name of the field to edit.

  • value (str) – The value to edit the field to.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

Example

# Chaining multiple field edits with reloading
Movie.editTitle('A New Title').editSummary('A new summary').editTagline('A new tagline').reload()
class plexapi.mixins.AddedAtMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have an added at date.

editAddedAt(addedAt, locked=True)[source]

Edit the added at date.

Parameters:
  • addedAt (int or str or datetime) – The new value as a unix timestamp (int), “YYYY-MM-DD” (str), or datetime object.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.ContentRatingMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a content rating.

editContentRating(contentRating, locked=True)[source]

Edit the content rating.

Parameters:
  • contentRating (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.EditionTitleMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have an edition title.

editEditionTitle(editionTitle, locked=True)[source]

Edit the edition title. Plex Pass is required to edit this field.

Parameters:
  • editionTitle (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.OriginallyAvailableMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have an originally available date.

editOriginallyAvailable(originallyAvailable, locked=True)[source]

Edit the originally available date.

Parameters:
  • originallyAvailable (str or datetime) – The new value “YYYY-MM-DD (str) or datetime object.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.OriginalTitleMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have an original title.

editOriginalTitle(originalTitle, locked=True)[source]

Edit the original title.

Parameters:
  • originalTitle (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.SortTitleMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a sort title.

editSortTitle(sortTitle, locked=True)[source]

Edit the sort title.

Parameters:
  • sortTitle (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.StudioMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a studio.

editStudio(studio, locked=True)[source]

Edit the studio.

Parameters:
  • studio (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.SummaryMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a summary.

editSummary(summary, locked=True)[source]

Edit the summary.

Parameters:
  • summary (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TaglineMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a tagline.

editTagline(tagline, locked=True)[source]

Edit the tagline.

Parameters:
  • tagline (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TitleMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a title.

editTitle(title, locked=True)[source]

Edit the title.

Parameters:
  • title (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TrackArtistMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a track artist.

editTrackArtist(trackArtist, locked=True)[source]

Edit the track artist.

Parameters:
  • trackArtist (str) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TrackNumberMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a track number.

editTrackNumber(trackNumber, locked=True)[source]

Edit the track number.

Parameters:
  • trackNumber (int) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TrackDiscNumberMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a track disc number.

editDiscNumber(discNumber, locked=True)[source]

Edit the track disc number.

Parameters:
  • discNumber (int) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.PhotoCapturedTimeMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a captured time.

editCapturedTime(capturedTime, locked=True)[source]

Edit the photo captured time.

Parameters:
  • capturedTime (str or datetime) – The new value “YYYY-MM-DD hh:mm:ss” (str) or datetime object.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.UserRatingMixin[source]

Bases: EditFieldMixin

Mixin for Plex objects that can have a user rating.

editUserRating(userRating, locked=True)[source]

Edit the user rating.

Parameters:
  • userRating (int) – The new value.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.EditTagsMixin[source]

Bases: object

Mixin for editing Plex object tags.

editTags(tag, items, locked=True, remove=False, **kwargs)[source]

Edit the tags of a Plex object. All tag editing methods can be chained together. Also see batchEdits() for batch editing tags.

Parameters:
  • tag (str) – Name of the tag to edit.

  • items (List<str> or List<MediaTag>) – List of tags to add or remove.

  • locked (bool) – True (default) to lock the tags, False to unlock the tags.

  • remove (bool) – True to remove the tags in items.

Example

# Chaining multiple tag edits with reloading
Show.addCollection('New Collection').removeGenre('Action').addLabel('Favorite').reload()
class plexapi.mixins.CollectionMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have collections.

addCollection(collections, locked=True)[source]

Add a collection tag(s).

Parameters:
  • collections (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeCollection(collections, locked=True)[source]

Remove a collection tag(s).

Parameters:
  • collections (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.CountryMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have countries.

addCountry(countries, locked=True)[source]

Add a country tag(s).

Parameters:
  • countries (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeCountry(countries, locked=True)[source]

Remove a country tag(s).

Parameters:
  • countries (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.DirectorMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have directors.

addDirector(directors, locked=True)[source]

Add a director tag(s).

Parameters:
  • directors (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeDirector(directors, locked=True)[source]

Remove a director tag(s).

Parameters:
  • directors (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.GenreMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have genres.

addGenre(genres, locked=True)[source]

Add a genre tag(s).

Parameters:
  • genres (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeGenre(genres, locked=True)[source]

Remove a genre tag(s).

Parameters:
  • genres (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.LabelMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have labels.

addLabel(labels, locked=True)[source]

Add a label tag(s).

Parameters:
  • labels (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeLabel(labels, locked=True)[source]

Remove a label tag(s).

Parameters:
  • labels (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.MoodMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have moods.

addMood(moods, locked=True)[source]

Add a mood tag(s).

Parameters:
  • moods (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeMood(moods, locked=True)[source]

Remove a mood tag(s).

Parameters:
  • moods (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.ProducerMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have producers.

addProducer(producers, locked=True)[source]

Add a producer tag(s).

Parameters:
  • producers (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeProducer(producers, locked=True)[source]

Remove a producer tag(s).

Parameters:
  • producers (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.SimilarArtistMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have similar artists.

addSimilarArtist(artists, locked=True)[source]

Add a similar artist tag(s).

Parameters:
  • artists (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeSimilarArtist(artists, locked=True)[source]

Remove a similar artist tag(s).

Parameters:
  • artists (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.StyleMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have styles.

addStyle(styles, locked=True)[source]

Add a style tag(s).

Parameters:
  • styles (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeStyle(styles, locked=True)[source]

Remove a style tag(s).

Parameters:
  • styles (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.TagMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have tags.

addTag(tags, locked=True)[source]

Add a tag(s).

Parameters:
  • tags (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeTag(tags, locked=True)[source]

Remove a tag(s).

Parameters:
  • tags (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.WriterMixin[source]

Bases: EditTagsMixin

Mixin for Plex objects that can have writers.

addWriter(writers, locked=True)[source]

Add a writer tag(s).

Parameters:
  • writers (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

removeWriter(writers, locked=True)[source]

Remove a writer tag(s).

Parameters:
  • writers (List<str> or List<MediaTag>) – List of tags.

  • locked (bool) – True (default) to lock the field, False to unlock the field.

class plexapi.mixins.WatchlistMixin[source]

Bases: object

Mixin for Plex objects that can be added to a user’s watchlist.

onWatchlist(account=None)[source]

Returns True if the item is on the user’s watchlist. Also see onWatchlist().

Parameters:

account (MyPlexAccount, optional) – Account to check item on the watchlist. Note: This is required if you are not connected to a Plex server instance using the admin account.

addToWatchlist(account=None)[source]

Add this item to the specified user’s watchlist. Also see addToWatchlist().

Parameters:

account (MyPlexAccount, optional) – Account to add item to the watchlist. Note: This is required if you are not connected to a Plex server instance using the admin account.

removeFromWatchlist(account=None)[source]

Remove this item from the specified user’s watchlist. Also see removeFromWatchlist().

Parameters:

account (MyPlexAccount, optional) – Account to remove item from the watchlist. Note: This is required if you are not connected to a Plex server instance using the admin account.

streamingServices(account=None)[source]

Return a list of Availability objects for the available streaming services for this item.

Parameters:

account (MyPlexAccount, optional) – Account used to retrieve availability. Note: This is required if you are not connected to a Plex server instance using the admin account.

class plexapi.mixins.MovieEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, ContentRatingMixin, EditionTitleMixin, OriginallyAvailableMixin, OriginalTitleMixin, SortTitleMixin, StudioMixin, SummaryMixin, TaglineMixin, TitleMixin, UserRatingMixin, CollectionMixin, CountryMixin, DirectorMixin, GenreMixin, LabelMixin, ProducerMixin, WriterMixin

class plexapi.mixins.ShowEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, ContentRatingMixin, OriginallyAvailableMixin, OriginalTitleMixin, SortTitleMixin, StudioMixin, SummaryMixin, TaglineMixin, TitleMixin, UserRatingMixin, CollectionMixin, GenreMixin, LabelMixin

class plexapi.mixins.SeasonEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, SummaryMixin, TitleMixin, UserRatingMixin, CollectionMixin, LabelMixin

class plexapi.mixins.EpisodeEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, ContentRatingMixin, OriginallyAvailableMixin, SortTitleMixin, SummaryMixin, TitleMixin, UserRatingMixin, CollectionMixin, DirectorMixin, LabelMixin, WriterMixin

class plexapi.mixins.ArtistEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, SortTitleMixin, SummaryMixin, TitleMixin, UserRatingMixin, CollectionMixin, CountryMixin, GenreMixin, LabelMixin, MoodMixin, SimilarArtistMixin, StyleMixin

class plexapi.mixins.AlbumEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, OriginallyAvailableMixin, SortTitleMixin, StudioMixin, SummaryMixin, TitleMixin, UserRatingMixin, CollectionMixin, GenreMixin, LabelMixin, MoodMixin, StyleMixin

class plexapi.mixins.TrackEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, TitleMixin, TrackArtistMixin, TrackNumberMixin, TrackDiscNumberMixin, UserRatingMixin, CollectionMixin, GenreMixin, LabelMixin, MoodMixin

class plexapi.mixins.PhotoalbumEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, AddedAtMixin, SortTitleMixin, SummaryMixin, TitleMixin, UserRatingMixin

class plexapi.mixins.PhotoEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, AddedAtMixin, PhotoCapturedTimeMixin, SortTitleMixin, SummaryMixin, TitleMixin, UserRatingMixin, TagMixin

class plexapi.mixins.CollectionEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, ThemeLockMixin, AddedAtMixin, ContentRatingMixin, SortTitleMixin, SummaryMixin, TitleMixin, UserRatingMixin, LabelMixin

class plexapi.mixins.PlaylistEditMixins[source]

Bases: ArtLockMixin, PosterLockMixin, SortTitleMixin, SummaryMixin, TitleMixin