Library plexapi.library¶
- class plexapi.library.Library(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a PlexServer library. This contains all sections of media defined in your Plex server including video, shows and audio.
- Variables
key (str) – ‘/library’
identifier (str) – Unknown (‘com.plexapp.plugins.library’).
mediaTagVersion (str) – Unknown (/system/bundle/media/flags/)
server (
PlexServer
) – PlexServer this client is connected to.title1 (str) – ‘Plex Library’ (not sure how useful this is).
title2 (str) – Second title (this is blank on my setup).
- sections()[source]¶
Returns a list of all media sections in this library. Library sections may be any of
MovieSection
,ShowSection
,MusicSection
,PhotoSection
.
- section(title)[source]¶
Returns the
LibrarySection
that matches the specified title.- Parameters
title (str) – Title of the section to return.
- sectionByID(sectionID)[source]¶
Returns the
LibrarySection
that matches the specified sectionID.- Parameters
sectionID (int) – ID of the section to return.
- Raises
NotFound – The library section ID is not found on the server.
- hubs(sectionID=None, identifier=None, **kwargs)[source]¶
Returns a list of
Hub
across all library sections.- Parameters
sectionID (int or str or list, optional) – IDs of the sections to limit results or “playlists”.
identifier (str or list, optional) – Names of identifiers to limit results. Available on Hub instances as the hubIdentifier attribute. Examples: ‘home.continue’ or ‘home.ondeck’
- all(**kwargs)[source]¶
Returns a list of all media from all library sections. This may be a very large dataset to retrieve.
- search(title=None, libtype=None, **kwargs)[source]¶
Searching within a library section is much more powerful. It seems certain attributes on the media objects can be targeted to filter this search down a bit, but I haven’t found the documentation for it.
Example: “studio=Comedy%20Central” or “year=1999” “title=Kung Fu” all work. Other items such as actor=<id> 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.
- cleanBundles()[source]¶
Poster images and other metadata for items in your library are kept in “bundle” packages. When you remove items from your library, these bundles aren’t immediately removed. Removing these old bundles can reduce the size of your install. By default, your server will automatically clean up old bundles once a week as part of Scheduled Tasks.
- emptyTrash()[source]¶
If a library has items in the Library Trash, use this option to empty the Trash.
- optimize()[source]¶
The Optimize option cleans up the server database from unused or fragmented data. For example, if you have deleted or added an entire library or many items in a library, you may like to optimize the database.
- refresh()[source]¶
Forces a download of fresh media information from the internet. This can take a long time. Any locked fields are not modified.
- deleteMediaPreviews()[source]¶
Delete the preview thumbnails for the all sections. This cannot be undone. Recreating media preview files can take hours or even days.
- add(name='', type='', agent='', scanner='', location='', language='en', *args, **kwargs)[source]¶
Simplified add for the most common options.
- Parameters
name (str) – Name of the library
agent (str) – Example com.plexapp.agents.imdb
type (str) – movie, show, # check me
location (str or list) – /path/to/files, [“/path/to/files”, “/path/to/morefiles”]
language (str) – Two letter language fx en
kwargs (dict) – Advanced options should be passed as a dict. where the id is the key.
Photo Preferences
agent (str): com.plexapp.agents.none
enableAutoPhotoTags (bool): Tag photos. Default value false.
enableBIFGeneration (bool): Enable video preview thumbnails. Default value true.
includeInGlobal (bool): Include in dashboard. Default value true.
scanner (str): Plex Photo Scanner
Movie Preferences
agent (str): com.plexapp.agents.none, com.plexapp.agents.imdb, tv.plex.agents.movie, com.plexapp.agents.themoviedb
enableBIFGeneration (bool): Enable video preview thumbnails. Default value true.
enableCinemaTrailers (bool): Enable Cinema Trailers. Default value true.
includeInGlobal (bool): Include in dashboard. Default value true.
scanner (str): Plex Movie, Plex Movie Scanner, Plex Video Files Scanner, Plex Video Files
IMDB Movie Options (com.plexapp.agents.imdb)
title (bool): Localized titles. Default value false.
extras (bool): Find trailers and extras automatically (Plex Pass required). Default value true.
only_trailers (bool): Skip extras which aren’t trailers. Default value false.
redband (bool): Use red band (restricted audiences) trailers when available. Default value false.
native_subs (bool): Include extras with subtitles in Library language. Default value false.
cast_list (int): Cast List Source: Default value 1 Possible options: 0:IMDb,1:The Movie Database.
ratings (int): Ratings Source, Default value 0 Possible options: 0:Rotten Tomatoes, 1:IMDb, 2:The Movie Database.
summary (int): Plot Summary Source: Default value 1 Possible options: 0:IMDb,1:The Movie Database.
country (int): Default value 46 Possible options 0:Argentina, 1:Australia, 2:Austria, 3:Belgium, 4:Belize, 5:Bolivia, 6:Brazil, 7:Canada, 8:Chile, 9:Colombia, 10:Costa Rica, 11:Czech Republic, 12:Denmark, 13:Dominican Republic, 14:Ecuador, 15:El Salvador, 16:France, 17:Germany, 18:Guatemala, 19:Honduras, 20:Hong Kong SAR, 21:Ireland, 22:Italy, 23:Jamaica, 24:Korea, 25:Liechtenstein, 26:Luxembourg, 27:Mexico, 28:Netherlands, 29:New Zealand, 30:Nicaragua, 31:Panama, 32:Paraguay, 33:Peru, 34:Portugal, 35:Peoples Republic of China, 36:Puerto Rico, 37:Russia, 38:Singapore, 39:South Africa, 40:Spain, 41:Sweden, 42:Switzerland, 43:Taiwan, 44:Trinidad, 45:United Kingdom, 46:United States, 47:Uruguay, 48:Venezuela.
collections (bool): Use collection info from The Movie Database. Default value false.
localart (bool): Prefer artwork based on library language. Default value true.
adult (bool): Include adult content. Default value false.
usage (bool): Send anonymous usage data to Plex. Default value true.
TheMovieDB Movie Options (com.plexapp.agents.themoviedb)
collections (bool): Use collection info from The Movie Database. Default value false.
localart (bool): Prefer artwork based on library language. Default value true.
adult (bool): Include adult content. Default value false.
country (int): Country (used for release date and content rating). Default value 47 Possible options 0:, 1:Argentina, 2:Australia, 3:Austria, 4:Belgium, 5:Belize, 6:Bolivia, 7:Brazil, 8:Canada, 9:Chile, 10:Colombia, 11:Costa Rica, 12:Czech Republic, 13:Denmark, 14:Dominican Republic, 15:Ecuador, 16:El Salvador, 17:France, 18:Germany, 19:Guatemala, 20:Honduras, 21:Hong Kong SAR, 22:Ireland, 23:Italy, 24:Jamaica, 25:Korea, 26:Liechtenstein, 27:Luxembourg, 28:Mexico, 29:Netherlands, 30:New Zealand, 31:Nicaragua, 32:Panama, 33:Paraguay, 34:Peru, 35:Portugal, 36:Peoples Republic of China, 37:Puerto Rico, 38:Russia, 39:Singapore, 40:South Africa, 41:Spain, 42:Sweden, 43:Switzerland, 44:Taiwan, 45:Trinidad, 46:United Kingdom, 47:United States, 48:Uruguay, 49:Venezuela.
Show Preferences
agent (str): com.plexapp.agents.none, com.plexapp.agents.thetvdb, com.plexapp.agents.themoviedb, tv.plex.agents.series
enableBIFGeneration (bool): Enable video preview thumbnails. Default value true.
episodeSort (int): Episode order. Default -1 Possible options: 0:Oldest first, 1:Newest first.
flattenSeasons (int): Seasons. Default value 0 Possible options: 0:Show,1:Hide.
includeInGlobal (bool): Include in dashboard. Default value true.
scanner (str): Plex TV Series, Plex Series Scanner
TheTVDB Show Options (com.plexapp.agents.thetvdb)
extras (bool): Find trailers and extras automatically (Plex Pass required). Default value true.
native_subs (bool): Include extras with subtitles in Library language. Default value false.
TheMovieDB Show Options (com.plexapp.agents.themoviedb)
collections (bool): Use collection info from The Movie Database. Default value false.
localart (bool): Prefer artwork based on library language. Default value true.
adult (bool): Include adult content. Default value false.
country (int): Country (used for release date and content rating). Default value 47 options 0:, 1:Argentina, 2:Australia, 3:Austria, 4:Belgium, 5:Belize, 6:Bolivia, 7:Brazil, 8:Canada, 9:Chile, 10:Colombia, 11:Costa Rica, 12:Czech Republic, 13:Denmark, 14:Dominican Republic, 15:Ecuador, 16:El Salvador, 17:France, 18:Germany, 19:Guatemala, 20:Honduras, 21:Hong Kong SAR, 22:Ireland, 23:Italy, 24:Jamaica, 25:Korea, 26:Liechtenstein, 27:Luxembourg, 28:Mexico, 29:Netherlands, 30:New Zealand, 31:Nicaragua, 32:Panama, 33:Paraguay, 34:Peru, 35:Portugal, 36:Peoples Republic of China, 37:Puerto Rico, 38:Russia, 39:Singapore, 40:South Africa, 41:Spain, 42:Sweden, 43:Switzerland, 44:Taiwan, 45:Trinidad, 46:United Kingdom, 47:United States, 48:Uruguay, 49:Venezuela.
Other Video Preferences
agent (str): com.plexapp.agents.none, com.plexapp.agents.imdb, com.plexapp.agents.themoviedb
enableBIFGeneration (bool): Enable video preview thumbnails. Default value true.
enableCinemaTrailers (bool): Enable Cinema Trailers. Default value true.
includeInGlobal (bool): Include in dashboard. Default value true.
scanner (str): Plex Movie Scanner, Plex Video Files Scanner
IMDB Other Video Options (com.plexapp.agents.imdb)
title (bool): Localized titles. Default value false.
extras (bool): Find trailers and extras automatically (Plex Pass required). Default value true.
only_trailers (bool): Skip extras which aren’t trailers. Default value false.
redband (bool): Use red band (restricted audiences) trailers when available. Default value false.
native_subs (bool): Include extras with subtitles in Library language. Default value false.
cast_list (int): Cast List Source: Default value 1 Possible options: 0:IMDb,1:The Movie Database.
ratings (int): Ratings Source Default value 0 Possible options: 0:Rotten Tomatoes,1:IMDb,2:The Movie Database.
summary (int): Plot Summary Source: Default value 1 Possible options: 0:IMDb,1:The Movie Database.
country (int): Country: Default value 46 Possible options: 0:Argentina, 1:Australia, 2:Austria, 3:Belgium, 4:Belize, 5:Bolivia, 6:Brazil, 7:Canada, 8:Chile, 9:Colombia, 10:Costa Rica, 11:Czech Republic, 12:Denmark, 13:Dominican Republic, 14:Ecuador, 15:El Salvador, 16:France, 17:Germany, 18:Guatemala, 19:Honduras, 20:Hong Kong SAR, 21:Ireland, 22:Italy, 23:Jamaica, 24:Korea, 25:Liechtenstein, 26:Luxembourg, 27:Mexico, 28:Netherlands, 29:New Zealand, 30:Nicaragua, 31:Panama, 32:Paraguay, 33:Peru, 34:Portugal, 35:Peoples Republic of China, 36:Puerto Rico, 37:Russia, 38:Singapore, 39:South Africa, 40:Spain, 41:Sweden, 42:Switzerland, 43:Taiwan, 44:Trinidad, 45:United Kingdom, 46:United States, 47:Uruguay, 48:Venezuela.
collections (bool): Use collection info from The Movie Database. Default value false.
localart (bool): Prefer artwork based on library language. Default value true.
adult (bool): Include adult content. Default value false.
usage (bool): Send anonymous usage data to Plex. Default value true.
TheMovieDB Other Video Options (com.plexapp.agents.themoviedb)
collections (bool): Use collection info from The Movie Database. Default value false.
localart (bool): Prefer artwork based on library language. Default value true.
adult (bool): Include adult content. Default value false.
country (int): Country (used for release date and content rating). Default value 47 Possible options 0:, 1:Argentina, 2:Australia, 3:Austria, 4:Belgium, 5:Belize, 6:Bolivia, 7:Brazil, 8:Canada, 9:Chile, 10:Colombia, 11:Costa Rica, 12:Czech Republic, 13:Denmark, 14:Dominican Republic, 15:Ecuador, 16:El Salvador, 17:France, 18:Germany, 19:Guatemala, 20:Honduras, 21:Hong Kong SAR, 22:Ireland, 23:Italy, 24:Jamaica, 25:Korea, 26:Liechtenstein, 27:Luxembourg, 28:Mexico, 29:Netherlands, 30:New Zealand, 31:Nicaragua, 32:Panama, 33:Paraguay, 34:Peru, 35:Portugal, 36:Peoples Republic of China, 37:Puerto Rico, 38:Russia, 39:Singapore, 40:South Africa, 41:Spain, 42:Sweden, 43:Switzerland, 44:Taiwan, 45:Trinidad, 46:United Kingdom, 47:United States, 48:Uruguay, 49:Venezuela.
- history(maxresults=9999999, mindate=None)[source]¶
Get Play History for all library Sections for the owner. :param maxresults: Only return the specified number of results (optional). :type maxresults: int :param mindate: Min datetime to return results from. :type mindate: datetime
- tags(tag)[source]¶
Returns a list of
LibraryMediaTag
objects for the specified tag.- Parameters
tag (str) – Tag name (see
TAGTYPES
).
- class plexapi.library.LibrarySection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Base class for a single library section.
- Variables
agent (str) – The metadata agent used for the library section (com.plexapp.agents.imdb, etc).
allowSync (bool) – True if you allow syncing content from the library section.
art (str) – Background artwork used to respresent the library section.
composite (str) – Composite image used to represent the library section.
createdAt (datetime) – Datetime the library section was created.
filters (bool) – True if filters are available for the library section.
key (int) – Key (or ID) of this library section.
language (str) – Language represented in this section (en, xn, etc).
locations (List<str>) – List of folder paths added to the library section.
refreshing (bool) – True if this section is currently being refreshed.
scanner (str) – Internal scanner used to find media (Plex Movie Scanner, Plex Premium Music Scanner, etc.)
thumb (str) – Thumbnail image used to represent the library section.
title (str) – Name of the library section.
type (str) – Type of content section represents (movie, show, artist, photo).
updatedAt (datetime) – Datetime the library section was last updated.
uuid (str) – Unique id for the section (32258d7c-3e6c-4ac5-98ad-bad7a3b78c63)
- fetchItems(ekey, cls=None, container_start=None, container_size=None, **kwargs)[source]¶
Load the specified key to find and build all items with the specified tag and attrs. See
fetchItem()
for more details on how this is used.- Parameters
container_start (None, int) – offset to get a subset of the data
container_size (None, int) – How many items in data
- property totalSize¶
Returns the total number of items in the library for the default library type.
- property totalDuration¶
Returns the total duration (in milliseconds) of items in the library.
- property totalStorage¶
Returns the total storage (in bytes) of items in the library.
- totalViewSize(libtype=None, includeCollections=True)[source]¶
Returns the total number of items in the library for a specified libtype. The number of items for the default library type will be returned if no libtype is specified. (e.g. Specify
libtype='episode'
for the total number of episodes orlibtype='albums'
for the total number of albums.)- Parameters
libtype (str, optional) – The type of items to return the total number for (movie, show, season, episode, artist, album, track, photoalbum). Default is the main library type.
includeCollections (bool, optional) – True or False to include collections in the total number. Default is True.
- edit(agent=None, **kwargs)[source]¶
Edit a library. See
Library
for example usage.- Parameters
agent (str, optional) – The library agent.
kwargs (dict) – Dict of settings to edit.
- addLocations(location)[source]¶
Add a location to a library.
- Parameters
location (str or list) – A single folder path, list of paths.
Example
LibrarySection.addLocations(‘/path/1’) LibrarySection.addLocations([‘/path/1’, ‘path/2’, ‘/path/3’])
- removeLocations(location)[source]¶
Remove a location from a library.
- Parameters
location (str or list) – A single folder path, list of paths.
Example
LibrarySection.removeLocations(‘/path/1’) LibrarySection.removeLocations([‘/path/1’, ‘path/2’, ‘/path/3’])
- get(title)[source]¶
Returns the media item with the specified title.
- Parameters
title (str) – Title of the item to return.
- Raises
NotFound – The title is not found in the library.
- getGuid(guid)[source]¶
Returns the media item with the specified external Plex, IMDB, TMDB, or TVDB ID. Note: Only available for the Plex Movie and Plex TV Series agents.
- Parameters
guid (str) – The external guid of the item to return. Examples: Plex
plex://show/5d9c086c46115600200aa2fe
IMDBimdb://tt0944947
, TMDBtmdb://1399
, TVDBtvdb://121361
.- Raises
NotFound – The guid is not found in the library.
Example
result1 = library.getGuid('plex://show/5d9c086c46115600200aa2fe') result2 = library.getGuid('imdb://tt0944947') result3 = library.getGuid('tmdb://1399') result4 = library.getGuid('tvdb://121361') # Alternatively, create your own guid lookup dictionary for faster performance guidLookup = {} for item in library.all(): guidLookup[item.guid] = item guidLookup.update({guid.id for guid in item.guids}} result1 = guidLookup['plex://show/5d9c086c46115600200aa2fe'] result2 = guidLookup['imdb://tt0944947'] result4 = guidLookup['tmdb://1399'] result5 = guidLookup['tvdb://121361']
- all(libtype=None, **kwargs)[source]¶
Returns a list of all items from this library section. See description of
search()
for details about filtering / sorting.
- lockAllField(field, libtype=None)[source]¶
Lock a field for all items in the library.
- Parameters
field (str) – The field to lock (e.g. thumb, rating, collection).
libtype (str, optional) – The library type to lock (movie, show, season, episode, artist, album, track, photoalbum, photo). Default is the main library type.
- unlockAllField(field, libtype=None)[source]¶
Unlock a field for all items in the library.
- Parameters
field (str) – The field to unlock (e.g. thumb, rating, collection).
libtype (str, optional) – The library type to lock (movie, show, season, episode, artist, album, track, photoalbum, photo). Default is the main library type.
- recentlyAdded(maxresults=50, libtype=None)[source]¶
Returns a list of media items recently added from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo). Default is the main library type.
- analyze()[source]¶
Run an analysis on all of the items in this library section. See See
analyze()
for more details.
- update(path=None)[source]¶
Scan this section for new media.
- Parameters
path (str, optional) – Full path to folder to scan.
- refresh()[source]¶
Forces a download of fresh media information from the internet. This can take a long time. Any locked fields are not modified.
- deleteMediaPreviews()[source]¶
Delete the preview thumbnails for items in this library. This cannot be undone. Recreating media preview files can take hours or even days.
- filterTypes()[source]¶
Returns a list of available
FilteringType
for this library section.
- getFilterType(libtype=None)[source]¶
Returns a
FilteringType
for a specified libtype.- Parameters
libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
- Raises
NotFound – Unknown libtype for this library.
- fieldTypes()[source]¶
Returns a list of available
FilteringFieldType
for this library section.
- getFieldType(fieldType)[source]¶
Returns a
FilteringFieldType
for a specified fieldType.- Parameters
fieldType (str) – The data type for the field (tag, integer, string, boolean, date, subtitleLanguage, audioLanguage, resolution).
- Raises
NotFound – Unknown fieldType for this library.
- listFilters(libtype=None)[source]¶
Returns a list of available
FilteringFilter
for a specified libtype. This is the list of options in the filter dropdown menu (screenshot).- Parameters
libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
Example
availableFilters = [f.filter for f in library.listFilters()] print("Available filter fields:", availableFilters)
- listSorts(libtype=None)[source]¶
Returns a list of available
FilteringSort
for a specified libtype. This is the list of options in the sorting dropdown menu (screenshot).- Parameters
libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
Example
availableSorts = [f.key for f in library.listSorts()] print("Available sort fields:", availableSorts)
- listFields(libtype=None)[source]¶
Returns a list of available
FilteringFields
for a specified libtype. This is the list of options in the custom filter dropdown menu (screenshot).- Parameters
libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
Example
availableFields = [f.key.split('.')[-1] for f in library.listFields()] print("Available fields:", availableFields)
- listOperators(fieldType)[source]¶
Returns a list of available
FilteringOperator
for a specified fieldType. This is the list of options in the custom filter operator dropdown menu (screenshot).- Parameters
fieldType (str) – The data type for the field (tag, integer, string, boolean, date, subtitleLanguage, audioLanguage, resolution).
Example
field = 'genre' # Available filter field from listFields() filterField = next(f for f in library.listFields() if f.key.endswith(field)) availableOperators = [o.key for o in library.listOperators(filterField.type)] print("Available operators for %s:" % field, availableOperators)
- listFilterChoices(field, libtype=None)[source]¶
Returns a list of available
FilterChoice
for a specifiedFilteringFilter
or filter field. This is the list of available values for a custom filter (screenshot).- Parameters
field (str) –
FilteringFilter
object, or the name of the field (genre, year, contentRating, etc.).libtype (str, optional) – The library type to filter (movie, show, season, episode, artist, album, track, photoalbum, photo, collection).
- Raises
BadRequest – Invalid filter field.
NotFound – Unknown filter field.
Example
field = 'genre' # Available filter field from listFilters() availableChoices = [f.title for f in library.listFilterChoices(field)] print("Available choices for %s:" % field, availableChoices)
- hubSearch(query, mediatype=None, limit=None)[source]¶
Returns the hub search results for this library. See
plexapi.server.PlexServer.search()
for details and parameters.
- search(title=None, sort=None, maxresults=None, libtype=None, container_start=0, container_size=100, limit=None, filters=None, **kwargs)[source]¶
Search the library. The http requests will be batched in container_size. If you are only looking for the first <num> 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.
- Parameters
title (str, optional) – General string query to search for. Partial string matches are allowed.
sort (
FilteringSort
or str or list, optional) – A field to sort the results. See the details below for more info.maxresults (int, optional) – Only return the specified number of results.
libtype (str, optional) – Return results of a specific type (movie, show, season, episode, artist, album, track, photoalbum, photo, collection) (e.g.
libtype='episode'
will only returnEpisode
objects)container_start (int, optional) – Default 0.
container_size (int, optional) – Default X_PLEX_CONTAINER_SIZE in your config file.
limit (int, optional) – Limit the number of results from the filter.
filters (dict, optional) – A dictionary of advanced filters. See the details below for more info.
**kwargs (dict) – Additional custom filters to apply to the search results. See the details below for more info.
- Raises
BadRequest – When the sort or filter is invalid.
NotFound – When applying an unknown sort or filter.
Sorting Results
The search results can be sorted by including the
sort
parameter.See
listSorts()
to get a list of available sort fields.
The
sort
parameter can be aFilteringSort
object or a sort string in the formatfield:dir
. The sort directiondir
can beasc
,desc
, ornullsLast
. Omitting the sort direction or using aFilteringSort
object will sort the results in the default direction of the field. Multi-sorting on multiple fields can be achieved by using a comma separated list of sort strings, or a list ofFilteringSort
object or strings.Examples
library.search(sort="titleSort:desc") # Sort title in descending order library.search(sort="titleSort") # Sort title in the default order # Multi-sort by year in descending order, then by audience rating in descending order library.search(sort="year:desc,audienceRating:desc") library.search(sort=["year:desc", "audienceRating:desc"])
Using Plex Filters
Any of the available custom filters can be applied to the search results (screenshot).
See
listFields()
to get a list of all available fields.See
listOperators()
to get a list of all available operators.See
listFilterChoices()
to get a list of all available filter values.
The following filter fields are just some examples of the possible filters. The list is not exhaustive, and not all filters apply to all library types.
actor (
MediaTag
): Search for the name of an actor.addedAt (datetime): Search for items added before or after a date. See operators below.
audioLanguage (str): Search for a specific audio language (3 character code, e.g. jpn).
collection (
MediaTag
): Search for the name of a collection.contentRating (
MediaTag
): Search for a specific content rating.country (
MediaTag
): Search for the name of a country.decade (int): Search for a specific decade (e.g. 2000).
director (
MediaTag
): Search for the name of a director.duplicate (bool) Search for duplicate items.
genre (
MediaTag
): Search for a specific genre.hdr (bool): Search for HDR items.
inProgress (bool): Search for in progress items.
label (
MediaTag
): Search for a specific label.lastViewedAt (datetime): Search for items watched before or after a date. See operators below.
mood (
MediaTag
): Search for a specific mood.producer (
MediaTag
): Search for the name of a producer.resolution (str): Search for a specific resolution (e.g. 1080).
studio (str): Search for the name of a studio.
style (
MediaTag
): Search for a specific style.subtitleLanguage (str): Search for a specific subtitle language (3 character code, e.g. eng)
unmatched (bool): Search for unmatched items.
unwatched (bool): Search for unwatched items.
userRating (int): Search for items with a specific user rating.
writer (
MediaTag
): Search for the name of a writer.year (int): Search for a specific year.
Tag type filter values can be a
FilterChoice
object,MediaTag
object, the exact nameMediaTag.tag
(str), or the exact idMediaTag.id
(int).Date type filter values can be a
datetime
object, a relative date using a one of the available date suffixes (e.g.30d
) (str), or a date inYYYY-MM-DD
(str) format.Relative date suffixes:
s
:seconds
m
:minutes
h
:hours
d
:days
w
:weeks
mon
:months
y
:years
Multiple values can be
OR
together by providing a list of values.Examples
library.search(unwatched=True, year=2020, resolution="4k") library.search(actor="Arnold Schwarzenegger", decade=1990) library.search(contentRating="TV-G", genre="animation") library.search(genre=["animation", "comedy"]) # Genre is animation OR comedy library.search(studio=["Disney", "Pixar"]) # Studio contains Disney OR Pixar
Using a
libtype
PrefixSome filters may be prefixed by the
libtype
separated by a.
(e.g.show.collection
,episode.title
,artist.style
,album.genre
,track.userRating
, etc.). This should not be confused with thelibtype
parameter. If nolibtype
prefix is provided, then the default library type is assumed. For example, in a TV show libraryviewCount
is assumed to beshow.viewCount
. If you want to filter using episode view count then you must specifyepisode.viewCount
explicitly. In addition, if the filter does not exist for the default library type it will fallback to the most specificlibtype
available. For example,show.unwatched
does not exists so it will fallback toepisode.unwatched
. Thelibtype
prefix cannot be included directly in the function parameters so the filters must be provided as a filters dictionary.Examples
library.search(filters={"show.collection": "Documentary", "episode.inProgress": True}) library.search(filters={"artist.genre": "pop", "album.decade": 2000}) # The following three options are identical and will return Episode objects showLibrary.search(title="Winter is Coming", libtype='episode') showLibrary.search(libtype='episode', filters={"episode.title": "Winter is Coming"}) showLibrary.searchEpisodes(title="Winter is Coming") # The following will search for the episode title but return Show objects showLibrary.search(filters={"episode.title": "Winter is Coming"}) # The following will fallback to episode.unwatched showLibrary.search(unwatched=True)
Using Plex Operators
Operators can be appended to the filter field to narrow down results with more granularity. The following is a list of possible operators depending on the data type of the filter being applied. A special
&
operator can also be used toAND
together a list of values.Type:
MediaTag
or subtitleLanguage or audioLanguageno operator:
is
!
:is not
Type: int
no operator:
is
!
:is not
>>
:is greater than
<<
:is less than
Type: str
no operator:
contains
!
:does not contain
=
:is
!=
:is not
<
:begins with
>
:ends with
Type: bool
no operator:
is true
!
:is false
Type: datetime
<<
:is before
>>
:is after
Type: resolution
no operator:
is
Operators cannot be included directly in the function parameters so the filters must be provided as a filters dictionary.
Examples
# Genre is horror AND thriller library.search(filters={"genre&": ["horror", "thriller"]}) # Director is not Steven Spielberg library.search(filters={"director!": "Steven Spielberg"}) # Title starts with Marvel and added before 2021-01-01 library.search(filters={"title<": "Marvel", "addedAt<<": "2021-01-01"}) # Added in the last 30 days using relative dates library.search(filters={"addedAt>>": "30d"}) # Collection is James Bond and user rating is greater than 8 library.search(filters={"collection": "James Bond", "userRating>>": 8})
Using Advanced Filters
Any of the Plex filters described above can be combined into a single
filters
dictionary that mimics the advanced filters used in Plex Web with a tree ofand
/or
branches. Each level of the tree must start withand
(Match all of the following) oror
(Match any of the following) as the dictionary key, and a list of dictionaries with the desired filters as the dictionary value.The following example matches this advanced filter in Plex Web.
Examples
advancedFilters = { 'and': [ # Match all of the following in this list { 'or': [ # Match any of the following in this list {'title': 'elephant'}, {'title': 'bunny'} ] }, {'year>>': 1990}, {'unwatched': True} ] } library.search(filters=advancedFilters)
Using PlexAPI Operators
For even more advanced filtering which cannot be achieved in Plex, the PlexAPI operators can be applied to any XML attribute. See
plexapi.base.PlexObject.fetchItems()
for a list of operators and how they are used. Note that using the Plex filters above will be faster since the filters are applied by the Plex server before the results are returned to PlexAPI. Using the PlexAPI operators requires the Plex server to return all results to allow PlexAPI to do the filtering. The Plex filters and the PlexAPI operators can be used in conjunction with each other.Examples
library.search(summary__icontains="Christmas") library.search(duration__gt=7200000) library.search(audienceRating__lte=6.0, audienceRatingImage__startswith="rottentomatoes://") library.search(media__videoCodec__exact="h265") library.search(genre="holiday", viewCount__gte=3)
- sync(policy, mediaSettings, client=None, clientId=None, title=None, sort=None, libtype=None, **kwargs)[source]¶
Add current library section as sync item for specified device. See description of
search()
for details about filtering / sorting andsync()
for possible exceptions.- Parameters
policy (
Policy
) – policy of syncing the media (how many items to sync and process watched media or not), generated automatically when method called on specific LibrarySection object.mediaSettings (
MediaSettings
) – Transcoding settings used for the media, generated automatically when method called on specific LibrarySection object.client (
MyPlexDevice
) – sync destination, seesync()
.clientId (str) – sync destination, see
sync()
.title (str) – descriptive title for the new
SyncItem
, if empty the value would be generated from metadata of current media.sort (str) – formatted as column:dir; column can be any of {addedAt, originallyAvailableAt, lastViewedAt, titleSort, rating, mediaHeight, duration}. dir can be asc or desc.
libtype (str) – Filter results to a specific libtype (movie, show, episode, artist, album, track).
- Returns
an instance of created syncItem.
- Return type
- Raises
BadRequest – When the library is not allowed to sync.
BadRequest – When the sort or filter is invalid.
NotFound – When applying an unknown sort or filter.
Example
from plexapi import myplex from plexapi.sync import Policy, MediaSettings, VIDEO_QUALITY_3_MBPS_720p c = myplex.MyPlexAccount() target = c.device('Plex Client') sync_items_wd = c.syncItems(target.clientIdentifier) srv = c.resource('Server Name').connect() section = srv.library.section('Movies') policy = Policy('count', unwatched=True, value=1) media_settings = MediaSettings.create(VIDEO_QUALITY_3_MBPS_720p) section.sync(target, policy, media_settings, title='Next best movie', sort='rating:desc')
- history(maxresults=9999999, mindate=None)[source]¶
Get Play History for this library Section for the owner. :param maxresults: Only return the specified number of results (optional). :type maxresults: int :param mindate: Min datetime to return results from. :type mindate: datetime
- createCollection(title, items=None, smart=False, limit=None, libtype=None, sort=None, filters=None, **kwargs)[source]¶
Alias for
createCollection()
using thisLibrarySection
.
- collection(title)[source]¶
Returns the collection with the specified title.
- Parameters
title (str) – Title of the item to return.
- Raises
NotFound – Unable to find collection.
- collections(**kwargs)[source]¶
Returns a list of collections from this library section. See description of
search()
for details about filtering / sorting.
- createPlaylist(title, items=None, smart=False, limit=None, sort=None, filters=None, **kwargs)[source]¶
Alias for
createPlaylist()
using thisLibrarySection
.
- playlist(title)[source]¶
Returns the playlist with the specified title.
- Parameters
title (str) – Title of the item to return.
- Raises
NotFound – Unable to find playlist.
- getWebURL(base=None, tab=None, key=None)[source]¶
Returns the Plex Web URL for the library.
- Parameters
base (str) – The base URL before the fragment (
#!
). Default is https://app.plex.tv/desktop.tab (str) – The library tab (recommended, library, collections, playlists, timeline).
key (str) – A hub key.
- class plexapi.library.MovieSection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibrarySection
Represents a
LibrarySection
section containing movies.- Variables
TAG (str) – ‘Directory’
TYPE (str) – ‘movie’
- recentlyAddedMovies(maxresults=50)[source]¶
Returns a list of recently added movies from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- sync(videoQuality, limit=None, unwatched=False, **kwargs)[source]¶
Add current Movie library section as sync item for specified device. See description of
search()
for details about filtering / sorting andsync()
for details on syncing libraries and possible exceptions.- Parameters
videoQuality (int) – idx of quality of the video, one of VIDEO_QUALITY_* values defined in
sync
module.limit (int) – maximum count of movies to sync, unlimited if None.
unwatched (bool) – if True watched videos wouldn’t be synced.
- Returns
an instance of created syncItem.
- Return type
Example
from plexapi import myplex from plexapi.sync import VIDEO_QUALITY_3_MBPS_720p c = myplex.MyPlexAccount() target = c.device('Plex Client') sync_items_wd = c.syncItems(target.clientIdentifier) srv = c.resource('Server Name').connect() section = srv.library.section('Movies') section.sync(VIDEO_QUALITY_3_MBPS_720p, client=target, limit=1, unwatched=True, title='Next best movie', sort='rating:desc')
- class plexapi.library.ShowSection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibrarySection
Represents a
LibrarySection
section containing tv shows.- Variables
TAG (str) – ‘Directory’
TYPE (str) – ‘show’
- recentlyAddedShows(maxresults=50)[source]¶
Returns a list of recently added shows from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- recentlyAddedSeasons(maxresults=50)[source]¶
Returns a list of recently added seasons from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- recentlyAddedEpisodes(maxresults=50)[source]¶
Returns a list of recently added episodes from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- sync(videoQuality, limit=None, unwatched=False, **kwargs)[source]¶
Add current Show library section as sync item for specified device. See description of
search()
for details about filtering / sorting andsync()
for details on syncing libraries and possible exceptions.- Parameters
videoQuality (int) – idx of quality of the video, one of VIDEO_QUALITY_* values defined in
sync
module.limit (int) – maximum count of episodes to sync, unlimited if None.
unwatched (bool) – if True watched videos wouldn’t be synced.
- Returns
an instance of created syncItem.
- Return type
Example
from plexapi import myplex from plexapi.sync import VIDEO_QUALITY_3_MBPS_720p c = myplex.MyPlexAccount() target = c.device('Plex Client') sync_items_wd = c.syncItems(target.clientIdentifier) srv = c.resource('Server Name').connect() section = srv.library.section('TV-Shows') section.sync(VIDEO_QUALITY_3_MBPS_720p, client=target, limit=1, unwatched=True, title='Next unwatched episode')
- class plexapi.library.MusicSection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibrarySection
Represents a
LibrarySection
section containing music artists.- Variables
TAG (str) – ‘Directory’
TYPE (str) – ‘artist’
- recentlyAddedArtists(maxresults=50)[source]¶
Returns a list of recently added artists from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- recentlyAddedAlbums(maxresults=50)[source]¶
Returns a list of recently added albums from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- recentlyAddedTracks(maxresults=50)[source]¶
Returns a list of recently added tracks from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- sync(bitrate, limit=None, **kwargs)[source]¶
Add current Music library section as sync item for specified device. See description of
search()
for details about filtering / sorting andsync()
for details on syncing libraries and possible exceptions.- Parameters
bitrate (int) – maximum bitrate for synchronized music, better use one of MUSIC_BITRATE_* values from the module
sync
.limit (int) – maximum count of tracks to sync, unlimited if None.
- Returns
an instance of created syncItem.
- Return type
Example
from plexapi import myplex from plexapi.sync import AUDIO_BITRATE_320_KBPS c = myplex.MyPlexAccount() target = c.device('Plex Client') sync_items_wd = c.syncItems(target.clientIdentifier) srv = c.resource('Server Name').connect() section = srv.library.section('Music') section.sync(AUDIO_BITRATE_320_KBPS, client=target, limit=100, sort='addedAt:desc', title='New music')
- class plexapi.library.PhotoSection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibrarySection
Represents a
LibrarySection
section containing photos.- Variables
TAG (str) – ‘Directory’
TYPE (str) – ‘photo’
- all(libtype=None, **kwargs)[source]¶
Returns a list of all items from this library section. See description of
plexapi.library.LibrarySection.search()
for details about filtering / sorting.
- collections(**kwargs)[source]¶
Returns a list of collections from this library section. See description of
search()
for details about filtering / sorting.
- recentlyAddedAlbums(maxresults=50)[source]¶
Returns a list of recently added photo albums from this library section.
- Parameters
maxresults (int) – Max number of items to return (default 50).
- sync(resolution, limit=None, **kwargs)[source]¶
Add current Music library section as sync item for specified device. See description of
search()
for details about filtering / sorting andsync()
for details on syncing libraries and possible exceptions.- Parameters
resolution (str) – maximum allowed resolution for synchronized photos, see PHOTO_QUALITY_* values in the module
sync
.limit (int) – maximum count of tracks to sync, unlimited if None.
- Returns
an instance of created syncItem.
- Return type
Example
from plexapi import myplex from plexapi.sync import PHOTO_QUALITY_HIGH c = myplex.MyPlexAccount() target = c.device('Plex Client') sync_items_wd = c.syncItems(target.clientIdentifier) srv = c.resource('Server Name').connect() section = srv.library.section('Photos') section.sync(PHOTO_QUALITY_HIGH, client=target, limit=100, sort='addedAt:desc', title='Fresh photos')
- class plexapi.library.LibraryTimeline(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a LibrarySection timeline.
- Variables
TAG (str) – ‘LibraryTimeline’
size (int) – Unknown
allowSync (bool) – Unknown
art (str) – Relative path to art image.
content (str) – “secondary”
identifier (str) – “com.plexapp.plugins.library”
latestEntryTime (int) – Epoch timestamp
mediaTagPrefix (str) – “/system/bundle/media/flags/”
mediaTagVersion (int) – Unknown
thumb (str) – Relative path to library thumb image.
title1 (str) – Name of library section.
updateQueueSize (int) – Number of items queued to update.
viewGroup (str) – “secondary”
viewMode (int) – Unknown
- class plexapi.library.Location(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single library Location.
- Variables
TAG (str) – ‘Location’
id (int) – Location path ID.
path (str) – Path used for library..
- class plexapi.library.Hub(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single Hub (or category) in the PlexServer search.
- Variables
TAG (str) – ‘Hub’
context (str) – The context of the hub.
hubKey (str) – API URL for these specific hub items.
hubIdentifier (str) – The identifier of the hub.
items (list) – List of items in the hub.
key (str) – API URL for the hub.
more (bool) – True if there are more items to load (call reload() to fetch all items).
size (int) – The number of items in the hub.
style (str) – The style of the hub.
title (str) – The title of the hub.
type (str) – The type of items in the hub.
- section()[source]¶
Returns the
LibrarySection
this hub belongs to.
- class plexapi.library.LibraryMediaTag(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Base class of library media tags.
- Variables
TAG (str) – ‘Directory’
count (int) – The number of items where this tag is found.
filter (str) – The URL filter for the tag.
id (int) – The id of the tag.
key (str) – API URL (/library/section/<librarySectionID>/all?<filter>).
librarySectionID (int) – The library section ID where the tag is found.
librarySectionKey (str) – API URL for the library section (/library/section/<librarySectionID>)
librarySectionTitle (str) – The library title where the tag is found.
librarySectionType (int) – The library type where the tag is found.
reason (str) – The reason for the search result.
reasonID (int) – The reason ID for the search result.
reasonTitle (str) – The reason title for the search result.
type (str) – The type of search result (tag).
tag (str) – The title of the tag.
tagType (int) – The type ID of the tag.
tagValue (int) – The value of the tag.
thumb (str) – The URL for the thumbnail of the tag (if available).
- class plexapi.library.Aperture(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Aperture library media tag.
- Variables
TAGTYPE (int) – 202
- class plexapi.library.Art(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Art library media tag.
- Variables
TAGTYPE (int) – 313
- class plexapi.library.Autotag(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Autotag library media tag.
- Variables
TAGTYPE (int) – 207
- class plexapi.library.Banner(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Banner library media tag.
- Variables
TAGTYPE (int) – 311
- class plexapi.library.Chapter(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Chapter library media tag.
- Variables
TAGTYPE (int) – 9
- class plexapi.library.Collection(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Collection library media tag.
- Variables
TAGTYPE (int) – 2
- class plexapi.library.Concert(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Concert library media tag.
- Variables
TAGTYPE (int) – 306
- class plexapi.library.Country(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Country library media tag.
- Variables
TAGTYPE (int) – 8
- class plexapi.library.Device(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Device library media tag.
- Variables
TAGTYPE (int) – 206
- class plexapi.library.Director(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Director library media tag.
- Variables
TAGTYPE (int) – 4
- class plexapi.library.Exposure(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Exposure library media tag.
- Variables
TAGTYPE (int) – 203
- class plexapi.library.Format(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Format library media tag.
- Variables
TAGTYPE (int) – 302
- class plexapi.library.Genre(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Genre library media tag.
- Variables
TAGTYPE (int) – 1
- class plexapi.library.Guid(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Guid library media tag.
- Variables
TAGTYPE (int) – 314
- class plexapi.library.ISO(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single ISO library media tag.
- Variables
TAGTYPE (int) – 204
- class plexapi.library.Label(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Label library media tag.
- Variables
TAGTYPE (int) – 11
- class plexapi.library.Lens(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Lens library media tag.
- Variables
TAGTYPE (int) – 205
- class plexapi.library.Make(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Make library media tag.
- Variables
TAGTYPE (int) – 200
- class plexapi.library.Marker(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Marker library media tag.
- Variables
TAGTYPE (int) – 12
- class plexapi.library.MediaProcessingTarget(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single MediaProcessingTarget library media tag.
- Variables
TAG (str) – ‘Tag’
TAGTYPE (int) – 42
- class plexapi.library.Model(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Model library media tag.
- Variables
TAGTYPE (int) – 201
- class plexapi.library.Mood(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Mood library media tag.
- Variables
TAGTYPE (int) – 300
- class plexapi.library.Network(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Network library media tag.
- Variables
TAGTYPE (int) – 319
- class plexapi.library.Place(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Place library media tag.
- Variables
TAGTYPE (int) – 400
- class plexapi.library.Poster(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Poster library media tag.
- Variables
TAGTYPE (int) – 312
- class plexapi.library.Producer(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Producer library media tag.
- Variables
TAGTYPE (int) – 7
- class plexapi.library.RatingImage(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single RatingImage library media tag.
- Variables
TAGTYPE (int) – 316
- class plexapi.library.Review(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Review library media tag.
- Variables
TAGTYPE (int) – 10
- class plexapi.library.Role(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Role library media tag.
- Variables
TAGTYPE (int) – 6
- class plexapi.library.Similar(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Similar library media tag.
- Variables
TAGTYPE (int) – 305
- class plexapi.library.Studio(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Studio library media tag.
- Variables
TAGTYPE (int) – 318
- class plexapi.library.Style(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Style library media tag.
- Variables
TAGTYPE (int) – 301
- class plexapi.library.Tag(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Tag library media tag.
- Variables
TAGTYPE (int) – 0
- class plexapi.library.Theme(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Theme library media tag.
- Variables
TAGTYPE (int) – 317
- class plexapi.library.Writer(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.library.LibraryMediaTag
Represents a single Writer library media tag.
- Variables
TAGTYPE (int) – 5
- class plexapi.library.FilteringType(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single filtering Type object for a library.
- Variables
TAG (str) – ‘Type’
active (bool) – True if this filter type is currently active.
fields (List<
FilteringField
>) – List of field objects.filters (List<
FilteringFilter
>) – List of filter objects.key (str) – The API URL path for the libtype filter.
sorts (List<
FilteringSort
>) – List of sort objects.title (str) – The title for the libtype filter.
type (str) – The libtype for the filter.
- class plexapi.library.FilteringFilter(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single Filter object for a
FilteringType
.- Variables
TAG (str) – ‘Filter’
filter (str) – The key for the filter.
filterType (str) – The
FilteringFieldType
type (string, boolean, integer, date, etc).key (str) – The API URL path for the filter.
title (str) – The title of the filter.
type (str) – ‘filter’
- class plexapi.library.FilteringSort(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single Sort object for a
FilteringType
.- Variables
TAG (str) – ‘Sort’
active (bool) – True if the sort is currently active.
activeDirection (str) – The currently active sorting direction.
default (str) – The currently active default sorting direction.
defaultDirection (str) – The default sorting direction.
descKey (str) – The URL key for sorting with desc.
firstCharacterKey (str) – API URL path for first character endpoint.
key (str) – The URL key for the sorting.
title (str) – The title of the sorting.
- class plexapi.library.FilteringField(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single Field object for a
FilteringType
.- Variables
TAG (str) – ‘Field’
key (str) – The URL key for the filter field.
title (str) – The title of the filter field.
type (str) – The
FilteringFieldType
type (string, boolean, integer, date, etc).subType (str) – The subtype of the filter (decade, rating, etc).
- class plexapi.library.FilteringFieldType(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single FieldType for library filtering.
- Variables
TAG (str) – ‘FieldType’
type (str) – The filtering data type (string, boolean, integer, date, etc).
operators (List<
FilteringOperator
>) – List of operator objects.
- class plexapi.library.FilteringOperator(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents an single Operator for a
FilteringFieldType
.- Variables
TAG (str) – ‘Operator’
key (str) – The URL key for the operator.
title (str) – The title of the operator.
- class plexapi.library.FilterChoice(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single FilterChoice object. These objects are gathered when using filters while searching for library items and is the object returned in the result set of
listFilterChoices()
.- Variables
TAG (str) – ‘Directory’
fastKey (str) – API URL path to quickly list all items with this filter choice. (/library/sections/<section>/all?genre=<key>)
key (str) – The id value of this filter choice.
thumb (str) – Thumbnail URL for the filter choice.
title (str) – The title of the filter choice.
type (str) – The filter type (genre, contentRating, etc).
- class plexapi.library.Folder(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a Folder inside a library.
- Variables
key (str) – Url key for folder.
title (str) – Title of folder.
- class plexapi.library.FirstCharacter(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a First Character element from a library.
- Variables
key (str) – Url key for character.
size (str) – Total amount of library items starting with this character.
title (str) – Character (#, !, A, B, C, …).
- class plexapi.library.Path(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single directory Path.
- Variables
TAG (str) – ‘Path’
home (bool) – True if the path is the home directory
key (str) – API URL (/services/browse/<base64path>)
network (bool) – True if path is a network location
path (str) – Full path to folder
title (str) – Folder name
- class plexapi.library.File(server, data, initpath=None, parent=None)[source]¶
Bases:
plexapi.base.PlexObject
Represents a single File.
- Variables
TAG (str) – ‘File’
key (str) – API URL (/services/browse/<base64path>)
path (str) – Full path to file
title (str) – File name