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

Bases: object

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: object

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: object

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: object

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: object

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: object

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: object

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: object

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: object

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: object

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: object

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

Bases: object

Mixing for Plex objects that can have smart filters.