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

Mixing 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.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.ArtMixin[source]

Bases: plexapi.mixins.ArtUrlMixin

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.

setArt(art)[source]

Set the background artwork for a Plex object.

Parameters

art (Art) – The art object to select.

lockArt()[source]

Lock the background artwork for a Plex object.

unlockArt()[source]

Unlock the background artwork for a Plex object.

class plexapi.mixins.BannerUrlMixin[source]

Bases: object

Mixin for Plex objects that can have a banner url.

property bannerUrl

Return the banner url for the Plex object.

class plexapi.mixins.BannerMixin[source]

Bases: plexapi.mixins.BannerUrlMixin

Mixin for Plex objects that can have banners.

banners()[source]

Returns list of available Banner objects.

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

Upload a banner 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.

setBanner(banner)[source]

Set the banner for a Plex object.

Parameters

banner (Banner) – The banner object to select.

lockBanner()[source]

Lock the banner for a Plex object.

unlockBanner()[source]

Unlock the banner for a Plex object.

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.PosterMixin[source]

Bases: plexapi.mixins.PosterUrlMixin

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.

setPoster(poster)[source]

Set the poster for a Plex object.

Parameters

poster (Poster) – The poster object to select.

lockPoster()[source]

Lock the poster for a Plex object.

unlockPoster()[source]

Unlock the poster for a Plex object.

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.ThemeMixin[source]

Bases: plexapi.mixins.ThemeUrlMixin

Mixin for Plex objects that can have themes.

themes()[source]

Returns list of available Theme objects.

uploadTheme(url=None, filepath=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.

lockTheme()[source]

Lock the theme for a Plex object.

unlockTheme()[source]

Unlock the theme for a Plex object.

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.ContentRatingMixin[source]

Bases: plexapi.mixins.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.OriginallyAvailableMixin[source]

Bases: plexapi.mixins.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) or datetime object.

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

class plexapi.mixins.OriginalTitleMixin[source]

Bases: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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: plexapi.mixins.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) or datetime object.

  • 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>) – 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: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have collections.

addCollection(collections, locked=True)[source]

Add a collection tag(s).

Parameters
  • collections (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.CountryMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have countries.

addCountry(countries, locked=True)[source]

Add a country tag(s).

Parameters
  • countries (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.DirectorMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have directors.

addDirector(directors, locked=True)[source]

Add a director tag(s).

Parameters
  • directors (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.GenreMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have genres.

addGenre(genres, locked=True)[source]

Add a genre tag(s).

Parameters
  • genres (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.LabelMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have labels.

addLabel(labels, locked=True)[source]

Add a label tag(s).

Parameters
  • labels (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.MoodMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have moods.

addMood(moods, locked=True)[source]

Add a mood tag(s).

Parameters
  • moods (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.ProducerMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have producers.

addProducer(producers, locked=True)[source]

Add a producer tag(s).

Parameters
  • producers (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.SimilarArtistMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have similar artists.

addSimilarArtist(artists, locked=True)[source]

Add a similar artist tag(s).

Parameters
  • artists (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.StyleMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have styles.

addStyle(styles, locked=True)[source]

Add a style tag(s).

Parameters
  • styles (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.TagMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have tags.

addTag(tags, locked=True)[source]

Add a tag(s).

Parameters
  • tags (list) – List of strings.

  • 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) – List of strings.

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

class plexapi.mixins.WriterMixin[source]

Bases: plexapi.mixins.EditTagsMixin

Mixin for Plex objects that can have writers.

addWriter(writers, locked=True)[source]

Add a writer tag(s).

Parameters
  • writers (list) – List of strings.

  • 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) – List of strings.

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