Plex Auto Collections is a Python 3 script that works off a configuration file to create/update Plex collections. Collection management with this tool can be automated in a varying degree of customizability. Supports IMDB, TMDb, and Trakt lists as well as built in Plex Searches using actors, genres, year, studio and more.

This script can be used as an interactive Python shell script as well as a headless, configuration-driven script.
The interactive shell script has some limited abilities including the ability to add new collections based off searches, delete collections, search for collections and manage existing collections. The bulk of the feature-set is focused on configuration-driven updates.
Some limited testing has been done only on Python 3.7 and 3.8 on Linux and Windows. Dependencies must be installed by running:
pip install -r requirements.txt
If there are issues installing dependencies try:
pip install -r requirements.txt --ignore-installed
To run the script in an interactive terminal run:
python plex_auto_collections.py
A config.yml file is required to run the script. The script checks for a config.yml file alongside plex_auto_collections.py as well as in config/config.yml. If desired, a different configuration file can be specified with -c <path_to_config> or --config-path <path_to_config>. This could be useful for creating collections against different libraries, such as a Movie and TV library (in this case, be sure to update the library_type in the configuration file).
python plex_auto_collections.py --config-path <path_to_config>
If you would like to run the script without any user interaction (e.g. to schedule the script to run on a schedule) the script can be launched with -u or --update:
python plex_auto_collections.py --update
If you would like the -u or --update option to update without updating metadata you can add -nm or --no_meta along with -u or --update:
python plex_auto_collections.py --update --no_meta
If you would like the -u or --update option to update without updating images you can add -ni or --no_images along with -u or --update:
python plex_auto_collections.py --update --no_images
Example command if you only want the collection to update without constantly updating metadata and images that don't change much
python plex_auto_collections.py --update --no_meta --no_images
A simple Dockerfile is available in this repo if you'd like to build it yourself. The official build is also available from dockerhub here: https://hub.docker.com/r/mza921/plex-auto-collections
The docker implementation today is limited but will improve over time. To use, try the following:
docker run --rm -v '/mnt/user/plex-auto-collections/':'/config':'rw' 'mza921/plex-auto-collections' -u
The -v '/mnt/user/plex-auto-collections/':'/config' mounts a persistent volume to store your config file. Today, the docker image defaults to running the config named config.yml in your persistent volume (eventually, the docker will support an environment variable to change the config path).
Lastly, you may need to run the docker with -it and without -u in order to interact with the script. For example, if you'd like to use Trakt lists, you need to go through the OAuth flow and interact with the script at first-run. After that, you should be able to run it without the -it flag.
The script allows utilizes a YAML config file to create collections in Plex. This is great for a few reasons:
There are currently six YAML mappings that can be set:
collections (required)plex (required)image_server (optional)tmdb (optional, but recommended)tautulli (optional)trakt (optional)radarr (optional)You can find a template config file in config/config.yml.template
Each collection is defined by the mapping name which becomes the name of the Plex collection. Additionally, there are many different attributes you can set for each collection:
The only required attribute for each collection is the list type. There are many different list types to choose from:
Note that most list types supports multiple lists, with the following exceptions:
You can create a collection based on the Plex search feature using the plex_search attribute. The search will return any movie/show that matches at least one term from each search option. You can run multiple searches. The search options are listed below.
| Search Option | Description | Movie Libraries | Show Libraries |
|---|---|---|---|
actor | Gets every movie with the specified actor | :heavy_check_mark: | :x: |
tmdb_actor | Gets every movie with the specified actor as well as the added TMDb metadata | :heavy_check_mark: | :x: |
country | Gets every movie with the specified country | :heavy_check_mark: | :x: |
decade | Gets every movie from the specified year + the 9 that follow i.e. 1990 will get you 1990-1999 | :heavy_check_mark: | :x: |
director | Gets every movie with the specified director | :heavy_check_mark: | :x: |
tmdb_director | Gets every movie with the specified director as well as the added TMDb metadata | :heavy_check_mark: | :x: |
genre | Gets every movie/show with the specified genre | :heavy_check_mark: | :heavy_check_mark: |
studio | Gets every movie/show with the specified studio | :heavy_check_mark: | :heavy_check_mark: |
year | Gets every movie/show with the specified year (Put a - between two years for a range i.e. year: 1990-1999 or end with NOW to go till current i.e. year: 2000-NOW) | :heavy_check_mark: | :heavy_check_mark: |
writer | Gets every movie with the specified writer | :heavy_check_mark: | :x: |
tmdb_writer | Gets every movie with the specified writer as well as the added TMDb metadata | :heavy_check_mark: | :x: |
Here's some high-level ideas:
collections:
Documentaries:
plex_search:
genre: Documentary
collections:
Dave Chappelle Comedy:
plex_search:
actor: Dave Chappelle
genre: Comedy
collections:
Pixar:
plex_search:
studio: Pixar
collections:
90s Movies:
plex_search:
year:
- 1990
- 1991
- 1992
- 1993
- 1994
- 1995
- 1996
- 1997
- 1998
- 1999
collections:
90s Movies:
plex_search:
year: 1990-1999
collections:
2010+ Movies:
plex_search:
year: 2010-NOW
collections:
90s Movies:
plex_search:
decade: 1990
Note if you only want to search using a single attribute you can do so without plex_search.
collections:
90s Movies:
year: 1990-1999
Notes:
plex_search but you can give the search multiple values.You can create Collections based on collections already in Plex
collections:
Dinosaurs:
plex_collection: Jurassic Park
Note if you want to add multiple collections you have to use a list. Comma separated values will not work.
collections:
Dinosaurs:
plex_collection:
- Jurassic Park
- The Land Before Time
The Movie Database (TMDb) strives to group movies into logical collections. This script can easily leverage that data. You can use the full url or just type in the TMDb ID for the collection:
collections:
Jurassic Park:
tmdb_collection: https://www.themoviedb.org/collection/328
collections:
Jurassic Park:
tmdb_collection: 328
collections:
Alien (Past & Present):
tmdb_collection:
- https://www.themoviedb.org/collection/8091
- 135416
Alternatively you can specify which tmdb_collection, tmdb_summary, tmdb_poster, and tmdb_background all at once by using tmdb_id and setting it to the collections page ID or URL:
collections:
Jurassic Park:
tmdb_id: 328
collections:
Alien (Past & Present):
tmdb_id: 8091, 135416
Anaconda:
tmdb_id: 105995, 336560
Notes:
tmdb_id can be either from a collection or an individual movietmdb_id but it will pull the summary, poster, and background from only the first one.tmdb_poster/tmdb_background if they exist unless tmdb_poster/tmdb_background is also specifiedtmdb_summary will load unless summary,tmdb_summary, or tmdb_biography is also specifiedSimilarly to tmdb_id, tmdb_actor, tmdb_director, tmdb_writer can specify tmdb_biography and tmdb_profile of the person's TMDb page ID or URL as well as search Plex using their respective Plex Search all with one attribute.
collections:
Robin Williams:
tmdb_actor: 2157
collections:
Robin Williams:
tmdb_actor: https://www.themoviedb.org/person/2157-robin-williams
collections:
Steven Spielberg:
tmdb_director: 488
collections:
Steven Spielberg:
tmdb_director: https://www.themoviedb.org/person/488-steven-spielberg
collections:
Quentin Tarantino:
tmdb_writer: 138
collections:
Quentin Tarantino:
tmdb_writer: https://www.themoviedb.org/person/138-quentin-tarantino
Notes:
tmdb_actor, tmdb_director, or tmdb_writer but it will pull the summary and poster from only the first one.tmdb_profile if they exist unless tmdb_profile is also specifiedtmdb_biography will load unless summary,tmdb_summary, or tmdb_biography is also specifiedYou can use a TMDb Company to build a collection based on all it's movies/shows by using tmdb_company. You can use the full url or just type in the TMDb ID for the collection:
collections:
Studio Ghibli:
tmdb_company: 10342
collections:
Studio Ghibli:
tmdb_company: https://www.themoviedb.org/company/10342
Similarly to using a TMDb Company, you can also use a TMDb Network to build a collection based on all it's shows by using tmdb_network. You can use the full url or just type in the TMDb ID for the collection:
collections:
CBS:
tmdb_network: 16
collections:
CBS:
tmdb_network: https://www.themoviedb.org/network/16
You can build a collection using TMDb's most popular movies/shows by using tmdb_popular. The tmdb_popular attribute only supports a single integer value. The sync_mode: sync option is recommended since the list is continuously updated.
collections:
TMDb Popular:
tmdb_popular: 30
sync_mode: sync
You can build a collection using TMDb's daily or weekly trending movies/shows by using tmdb_trending_daily or tmdb_trending_weekly. Both attributes only support a single integer value. The sync_mode: sync option is recommended since the lists are continuously updated.
collections:
TMDb Daily Trending:
tmdb_trending_daily: 30
sync_mode: sync
collections:
TMDb Weekly Trending:
tmdb_trending_weekly: 30
sync_mode: sync
You can build a collection using TMDb's top rated movies/shows by using tmdb_top_rated. The tmdb_top_rated attribute only supports a single integer value. The sync_mode: sync option is recommended since the list is continuously updated.
collections:
TMDb Top Rated:
tmdb_top_rated: 30
sync_mode: sync
You can build a collection using TMDb's release_type to get movies that are now in theaters by using tmdb_now_playing. The tmdb_now_playing attribute only supports a single integer value. The sync_mode: sync option is recommended since the list is continuously updated.
collections:
TMDb Now Playing:
tmdb_now_playing: 30
sync_mode: sync
You can use TMDb's discover engine to create a collection based on the search for movies/shows using all different sorts of parameters shown below. The parameters are directly from TMDb Movie Discover and TMDb TV Discover
| Type | Description |
|---|---|
| String | Any number of alphanumeric characters |
| Integer | Any whole number greater then zero i.e. 2, 10, 50 |
| Number | Any number greater then zero i.e. 2.5, 7.4, 9 |
| Boolean | Must be true or false |
Date: MM/DD/YYYY | Date that fits the specified format |
Year: YYYY | Year must be a 4 digit integer i.e. 1990 |
| Movie Parameters | Description | Type |
|---|---|---|
limit | Specify how many movies you want returned by the query. (default: 100) | Integer |
language | Specify a language to query translatable fields with. (default: en-US) | ([a-z]{2})-([A-Z]{2}) |
region | Specify a ISO 3166-1 code to filter release dates. Must be uppercase. | ^[A-Z]{2}$ |
sort_by | Choose from one of the many available sort options. (default: popularity.desc) | See sort options below |
certification_country | Used in conjunction with the certification parameter, use this to specify a country with a valid certification. | String |
certification | Filter results with a valid certification from the certification_country parameter. | String |
certification.lte | Filter and only include movies that have a certification that is less than or equal to the specified value. | String |
certification.gte | Filter and only include movies that have a certification that is greater than or equal to the specified value. | String |
include_adult | A filter and include or exclude adult movies. | Boolean |
primary_release_year | A filter to limit the results to a specific primary release year. | Year: YYYY |
primary_release_date.gte | Filter and only include movies that have a primary release date that is greater or equal to the specified value. | Date: MM/DD/YYYY |
primary_release_date.lte | Filter and only include movies that have a primary release date that is less than or equal to the specified value. | Date: MM/DD/YYYY |
release_date.gte | Filter and only include movies that have a release date (looking at all release dates) that is greater or equal to the specified value. | Date: MM/DD/YYYY |
release_date.lte | Filter and only include movies that have a release date (looking at all release dates) that is less than or equal to the specified value. | Date: MM/DD/YYYY |
year | A filter to limit the results to a specific year (looking at all release dates). | Year: YYYY |
vote_count.gte | Filter and only include movies that have a vote count that is greater or equal to the specified value. | Integer |
vote_count.lte | Filter and only include movies that have a vote count that is less than or equal to the specified value. | Integer |
vote_average.gte | Filter and only include movies that have a rating that is greater or equal to the specified value. | Number |
vote_average.lte | Filter and only include movies that have a rating that is less than or equal to the specified value. | Number |
with_cast | A comma separated list of person ID's. Only include movies that have one of the ID's added as an actor. | String |
with_crew | A comma separated list of person ID's. Only include movies that have one of the ID's added as a crew member. | String |
with_people | A comma separated list of person ID's. Only include movies that have one of the ID's added as a either a actor or a crew member. | String |
with_companies | A comma separated list of production company ID's. Only include movies that have one of the ID's added as a production company. | String |
with_genres | Comma separated value of genre ids that you want to include in the results. | String |
without_genres | Comma separated value of genre ids that you want to exclude from the results. | String |
with_keywords | A comma separated list of keyword ID's. Only includes movies that have one of the ID's added as a keyword. | String |
without_keywords | Exclude items with certain keywords. You can comma and pipe separate these values to create an 'AND' or 'OR' logic. | String |
with_runtime.gte | Filter and only include movies that have a runtime that is greater or equal to a value. | Integer |
with_runtime.lte | Filter and only include movies that have a runtime that is less than or equal to a value. | Integer |
with_original_language | Specify an ISO 639-1 string to filter results by their original language value. | String |
| Show Parameters | Description | Type |
|---|---|---|
limit | Specify how many movies you want returned by the query. (default: 100) | Integer |
language | Specify a language to query translatable fields with. (default: en-US) | ([a-z]{2})-([A-Z]{2}) |
sort_by | Choose from one of the many available sort options. (default: popularity.desc) | See sort options below |
air_date.gte | Filter and only include TV shows that have a air date (by looking at all episodes) that is greater or equal to the specified value. | Date: MM/DD/YYYY |
air_date.lte | Filter and only include TV shows that have a air date (by looking at all episodes) that is less than or equal to the specified value. | Date: MM/DD/YYYY |
first_air_date.gte | Filter and only include TV shows that have a original air date that is greater or equal to the specified value. Can be used in conjunction with the include_null_first_air_dates filter if you want to include items with no air date. | Date: MM/DD/YYYY |
first_air_date.lte | Filter and only include TV shows that have a original air date that is less than or equal to the specified value. Can be used in conjunction with the include_null_first_air_dates filter if you want to include items with no air date. | Date: MM/DD/YYYY |
first_air_date_year | Filter and only include TV shows that have a original air date year that equal to the specified value. Can be used in conjunction with the include_null_first_air_dates filter if you want to include items w |
Content type
Image
Digest
Size
54.2 MB
Last updated
over 5 years ago
docker pull mza921/plex-auto-collections