Skip to content

Latest commit

 

History

History
277 lines (228 loc) · 15.1 KB

Smart-Builders.md

File metadata and controls

277 lines (228 loc) · 15.1 KB

Using Plex Meta Manager you can create Smart Collections in two different ways.

Smart Label

A Smart Label Collection is a smart collection that grabs every item with a specific label generated by the program. That label is added to all the items the Collection Builders find instead of being added to a normal collection.

You can add smart_label giving it one of the sorts from the Movies/Shows column of the Sorts Table below along with any other builder to make that collection a Smart Label Collection.

This is extremely useful because smart collections don't follow normal show/hide rules and can eliminate the need to have Plex Collectionless when used correctly. To fix the issue described in Plex Collectionless you would make Marvel Cinematic Universe a Smart Label Collection and all other Marvel collection just normal collections and they will show/hide all the movie properly.

To have the Smart Label Collections to eliminate Plex Collectionless you have to go all in on using them. A good rule of thumb to make sure this works correctly is that every item in your library should have a max of one non-smart collection.

Reach out on the Plex Meta Manager Discord or in the Github Discussions for help if you're having any issues getting this to work properly.

Smart Filter

Uses Plex's Advance Filters to create a smart collection based on the filter parameters provided.

Any Advance Filter made using the Plex UI should be able to be recreated using smart_filter. If you're having trouble getting smart_filter to work correctly, build the collection you want inside of Plex's Advance Filters and take a screenshot of the parameters in the Plex UI and post it in either the Discussions or on Discord and I'll do my best to help you.

like Plex's Advance Filters you have to start each filter with either any or all as a base. You can only have one base attribute and all filter attributes must be under the base.

Inside the base attribute you can use any filter below or nest more any or all. You can have as many nested any or all next to each other as you want. If using multiple any or all you will have to do so in the form of a list.

There are a couple other attributes you can have at the top level only along with the base attribute are:

Special Attributes

Special Option Attribute Description Default
Type type The Type of items inside this collection
Options: movies, shows, seasons, and episodes
movies for Movies Libraries and shows for Show Libraries
Limit limit The max number of item for the filter all
Sort By sort_by This will control how the filter is sorted in your library. You can use any sort options for your search type in the Sorts Table random
Validate validate Determines if a collection will fail on a validation error
Options: true or false
true

Sort Options

Sort Option Description Movies Shows Seasons Episodes
title.asc/title.desc Sort by Title ✔️ ✔️ ✔️
season.asc/season.desc Sort by Season ✔️
show.asc/show.desc Sort by Show ✔️ ✔️
year.asc/year.desc Sort by Year ✔️ ✔️ ✔️
release.asc/
release.desc
Sort by Release Date (Originally Available) ✔️ ✔️ ✔️
critic_rating.asc/
critic_rating.desc
Sort by Critic Rating ✔️ ✔️ ✔️
audience_rating.asc/
audience_rating.desc
Sort by Audience Rating ✔️ ✔️ ✔️
user_rating.asc/
user_rating.desc
Sort by User Rating ✔️ ✔️ ✔️ ✔️
content_rating.asc/
content_rating.desc
Sort by Content Rating ✔️ ✔️
duration.asc/duration.desc Sort by Duration ✔️ ✔️
plays.asc/plays.desc Sort by Number of Plays ✔️ ✔️
added.asc/added.desc Sort by Date Added ✔️ ✔️ ✔️ ✔️
episode_added.asc/
episode_added.desc
Sort by Last Episode Date Added ✔️
random Sort by Random ✔️ ✔️ ✔️ ✔️

Filters

There are three fields per filter option when using Plex's Advance Filters in the Web UI. The first is the Attribute (what attribute you wish to filter), the second is the Modifier (which modifier to use), and the third is the Term (actual term to filter).

String Filters

String filters can be used with either no modifier or with .not, .is, .isnot, .begins, or .ends.

String filter can take multiple values only as a list.

String Modifiers

String Modifier Description Plex Web UI Display
No Modifier Matches every item where the attribute contains the given string contains
.not Matches every item where the attribute does not contain the given string does not contain
.is Matches every item where the attribute exactly matches the given string is
.isnot Matches every item where the attribute does not exactly match the given string is not
.begins Matches every item where the attribute begins with the given string begins with
.ends Matches every item where the attribute ends with the given string ends with

String Attributes

String Filter Description Movie
Libraries
Show
Libraries
title Uses the title attribute to match ✔️ ✔️
episode_title Uses the title attribute of the show's episodes to match ✔️
studio Uses the studio attribute to match ✔️ ✔️

Tag Filters

Tag filters can be used with either no modifier or with .not except for decade and resolution which can only be used with no modifier.

Tag filter can take multiple values as a list or a comma-separated string.

Tag Modifiers

Tag Modifier Description Plex Web UI Display
No Modifier Matches every item where the attribute matches the given string is
.not Matches every item where the attribute does not match the given string is not

Tag Attributes

Tag Filter Description Movie
Libraries
Show
Libraries
actor Uses the actor tags to match ✔️ ✔️
audio_language Uses the audio language tags to match ✔️ ✔️
collection Uses the collection tags to match ✔️ ✔️
content_rating Uses the content rating tags to match ✔️ ✔️
country Uses the country tags to match ✔️
decade Uses the year tag to match the decade ✔️
director Uses the director tags to match ✔️
genre Uses the genre tags to match ✔️ ✔️
label Uses the label tags to match ✔️ ✔️
network Uses the network tags to match
Only works with the New Plex TV Agent
✔️
producer Uses the actor tags to match ✔️
resolution Uses the resolution tags to match ✔️ ✔️
subtitle_language Uses the subtitle language tags to match ✔️ ✔️
writer Uses the writer tags to match ✔️
year Uses the year tag to match ✔️ ✔️
episode_year Uses the year tag to match ✔️

Date Filters

Date filters can be used with either no modifier or with .not, .before, or .after.

No date filter can take multiple values.

Date Modifiers

Date Modifier Description Format Plex Web UI Display
No Modifier Matches every item where the date attribute
is in the last X days
Format: number of days
e.g. 30
is in the last
.not Matches every item where the date attribute
is not in the last X days
Format: number of days
e.g. 30
is not in the last
.before Matches every item where the date attribute
is before the given date
Format: MM/DD/YYYY
e.g. 01/01/2000
is before
.after Matches every item where the date attribute
is after the given date
Format: MM/DD/YYYY
e.g. 01/01/2000
is after

Date Attributes

Date Filter Description Movie
Libraries
Show
Libraries
added Uses the date added attribute to match ✔️ ✔️
episode_added Uses the date added attribute of the show's episodes to match ✔️
release Uses the release date attribute (originally available) to match ✔️ ✔️
episode_air_date Uses the air date attribute (originally available) of the show's episodes to match ✔️
last_played Uses the date last played attribute to match ✔️ ✔️
episode_last_played Uses the date last played attribute of the show's episodes to match ✔️

Number Filters

Number filters must use .gt, .gte, .lt, or .lte as a modifier.

No number filter can take multiple values.

Number Modifiers

Number Modifier Description Format Plex Web UI Display
.gt Matches every item where the number attribute
is greater then the given number
Format: number
e.g. 30, 1995, or 7.5
is greater than
.gte Matches every item where the number attribute
is greater then or equal to the given number
Format: number
e.g. 30, 1995, or 7.5
N/A
.lt Matches every item where the number attribute
is less then the given number
Format: number
e.g. 30, 1995, or 7.5
is less than
.lte Matches every item where the number attribute
is less then or equal to the given number
Format: number
e.g. 30, 1995, or 7.5
N/A

Number Attributes

Number Filter Description Restrictions Movie
Libraries
Show
Libraries
duration Uses the duration attribute to match using minutes minimum: 1 ✔️
plays Uses the plays attribute to match minimum: 1 ✔️ ✔️
episode_plays Uses the plays attribute of the show's episodes to match minimum: 1 ✔️
critic_rating Uses the critic rating attribute to match 0.0 - 10.0 ✔️ ✔️
audience_rating Uses the audience rating attribute to match 0.0 - 10.0 ✔️ ✔️
user_rating Uses the user rating attribute to match 0.0 - 10.0 ✔️ ✔️
episode_user_rating Uses the user rating attribute of the show's episodes to match 0.0 - 10.0 ✔️
year Uses the year attribute to match 1800 - Current Year ✔️ ✔️
episode_year Uses the year attribute of the show's episodes to match 1800 - Current Year ✔️

Boolean Filters

Boolean Filters take no modifier and can only be either true or false.

Boolean Attributes

Boolean Filter Description Movie
Libraries
Show
Libraries
hdr Is HDR ✔️ ✔️
unmatched Is Unmatched ✔️
duplicate Is Duplicate ✔️
unplayed Is Unplayed ✔️
progress Is In Progress ✔️
trash Is Trashed ✔️ ✔️
unplayed_episodes Has Unplayed Episodes ✔️
episode_unplayed Has Episodes Unplayed ✔️
episode_duplicate Has Duplicate Episodes ✔️
episode_progress Has Episode Progress ✔️
episode_unmatched Has Episodes Unmatched ✔️

Smart Filter Examples

A few examples are listed below:

collections:
  Documentaries:
    smart_filter:
      all:
        genre: Documentary
collections:
  Dave Chappelle Comedy:
    smart_filter:
      all:
        actor: Dave Chappelle
        genre: Comedy
collections:
  Top Action Movies:
    smart_filter:
      all:
        genre: Action
      sort_by: audience_rating.desc
      limit: 20
collections:
  90s Movies:
    smart_filter:
      any:
        year:
          - 1990
          - 1991
          - 1992
          - 1993
          - 1994
          - 1995
          - 1996
          - 1997
          - 1998
          - 1999
collections:
  90s Movies:
    smart_filter:
      any:
        decade: 1990
collections:
  Best 2010+ Movies:
    smart_filter:
      all:
        year.gte: 2010
      sort_by: audience_rating.desc
      limit: 20

If you specify TMDb Person ID's using the Collection Detail tmdb_person and then tell either actor, director, producer, or writer to add tmdb, the script will translate the TMDb Person IDs into their names and run the search on those names.

collections:
  Robin Williams:
    smart_filter:
      all:
        actor: tmdb
    tmdb_person: 2157
collections:
  Steven Spielberg:
    smart_filter:
      all:
        director: tmdb
    tmdb_person: https://www.themoviedb.org/person/488-steven-spielberg
collections:
  Quentin Tarantino:
    smart_filter:
      any:
        actor: tmdb
        director: tmdb
        producer: tmdb
        writer: tmdb
    tmdb_person: 138