Skip to main content
Version: Next

Rules

Rules are the core of Maintainerr. They evaluate your Plex media based on the parameters you set. If a media item matches a rule, it is added to a collection.

Media in a collection will remain there for the number of days you specify. After that period, Maintainerr will delete the media from disk and any connected external applications. If a collections media item no longer matches a rule, it will be removed from it.

Rule Handling

Rule handling is a batch process that runs every 8 hours (this interval can be changed in the settings). During each run, Maintainerr checks all your rules and updates collections by adding or removing media items as needed. You can manually trigger this process with the Run Rules button on the 'Rules' page.

Creating rules

General

General info about the rule. Some of the information specified here will be shown on the generated collection. In here you also specify how to handle the collection.

ParameterDescription
NameThe Rule and Collection name
DescriptionDescription of the Rule. This is also used as the Collection's description
LibraryWhich media library to use
Media typeThe type of TV media the rules will apply to, either the entire show, only seasons or only episodes
Radarr serverThe server that Radarr specific rules and actions will be applied to
Radarr actionUnmonitor or delete movies from Radarr
Sonarr serverThe server that Sonarr specific rules and actions will be applied to
Sonarr actionUnmonitor or delete series from Sonarr
Media server actionDelete media from your media server directly. Only applicable when no *arr server is selected.
Do nothing actionNo action will be taken on the media in this collection.
ActiveIf inactive, the rule won't run
Show on library recommendedShow the rule's collection on the library recommended screen
Show on homeShow the rule's collection on the home screen
Add list exclusionsPrevent *arr import lists from re-adding media that has been removed by Maintainerr
Media deleted after daysAmount of days media will live in the collection before deletion
Use rulesDisable the rule engine, for when you want to add media to the collection manually
Force reset Seerr recordForce resets the Seerr record by deleting any requests instead of relying on availability-sync. 'Enable CSRF Protection' needs to be disabled in Seerr's settings for this to work. +
Custom collectionUse a manually created collection. Maintainerr will never automatically add or remove this collection from your media server.
Custom collection nameThe name of the manual collection to use +

TV media type

With the Media type parameter, you specify which type of media to target in a TV library. This allows you to run rules on shows, seasons, or episodes.

For example, you might create a rule group that selects and deletes old or watched seasons of a TV show, while keeping newer seasons untouched. Alternatively, you could target watched episodes and set them to unmonitored in Sonarr.

note
  • Plex collections cannot contain mixed media types. Therefore, Maintainerr restricts each rule group / collection to a single media type.

  • Running rules on episodes is slower than on shows or seasons, as Maintainerr must process a larger volume of data.

Manual collections

If you prefer to manage Plex collections yourself or use a different tool, you can enable the manual collection option. With this enabled, Maintainerr will not automatically create and delete collections in Plex.

Adding rules

Adding a rule is done by using the Add button next to a section title. If the button is not available, it means your current rule isn't finished yet.

A rule consists of at least 4 values. If the second value contains a custom value, a custom value parameter will also pop up.

Starting from the second rule or section, a operator parameter is also required. Here you must specify the action to take on the results of the previous rule.

ParamDescription
OperatorAction to take on the previous rule or section
First valueThe first value to compare with
ActionThe comparable action to take
Second valueThe second value to compare with
Custom valueA custom value input

Sections

A section is a group of rules. What happens to the result of a section depends on the choice of Operator in the section's first rule.

Adding new sections

The New section button, at the bottom of the form, is only available if all rules are completed.

Operators

There are 2 operator choices, both explained below. The choice of operator defines what happens to the result of each section or rule.

AND

Using this operator, the rule will run against the result of the previous rule (or section). The output of the rule will then be passed on to the next rule.

OR

Using this operator, the rule will start off with all media and add its result to the previous rule (or section) result. The output of the rule will then be passed on to the next rule.

Actions

The action defines the way the first value and second value will be compared. The available actions are dependent on the type of the first value

ActionDescriptionTypes
biggerIs the first value bigger than the second value ?number
smallerIs the first value smaller than the second value ?number
containsDoes the first value contain the second value? Lists will confirm the existence of an exact match within the first value listnumber, text
contains (partial)Does the first value contain the second value ? Lists will confirm the existence of a partial match within the first value listnumber, text
not containsDoes the first value lack the second value? Lists will indicate the absence of an exact match within the first value list.number, text
not contains (partial)Does the first value lack the second value ? Lists will indicate the absence of a partial match within the first value list.number, text
equalsIs the first value equal to the second value ?number, text, date
not equalsIs the first value unequal to the second value ?number, text, date
beforeDoes the first value occur before the second value ?date
afterDoes the first value occur after the second value ?date
in lastDoes the first value occur in the last x amount of days ?date
in nextDoes the first value occur in the next x amount of days ?date

The difference between Contains/Contains (exact) and Contains (partial) is only apparent with list values. When comparing a text list, Contains (exact) will only return true if the second value exactly matches any value in the first value list. Contains (partial) will return true if the first value list has a value that partially matches any value in the second value list.

List Examples

True `Contains (partial)`
firstValue:
- user1
- user2
- user3
secondValue:
- use
- ser
- ser3
- user
- ser1
- er3
True `Contains (partial)`
firstValue:
- user1
- user2
- user3
secondValue:
- user1
- user2
- user3
- user5
False `Contains (partial)`
firstValue:
- user1
- user2
- user3
secondValue:
- friend
- james
- wilhelm
- frank
True `Contains (exact)`
firstValue:
- user1
- user2
- user3
secondValue:
- user1
- user2
- user5
True `Contains (exact)`
firstValue:
- user1
- user2
- user3
- user7
secondValue:
- user1
- user2
- user7
True `Contains (exact)`
firstValue:
- user1
- user2
- user3
secondValue:
- user1
- user5
- user8
False `Contains (exact)`
firstValue:
- user1
- user2
- user3
secondValue:
- use
- friend
- 1
- 2
- 3

Custom values

The second value field allows some custom values. The available custom values are dependent on the type of first value.

ActionDescriptionTypes
Custom daysThis behavior depends on the selected action. In case of in_last or in_next, this translates to 'in the last (or next) x days'. in case of before the value will be translated to the current date subtracted by the amount of custom days. In all other cases, the amount of days will be added to the current datedate
Custom dateTakes a specific datedate
Custom numberTakes a specific numbernumber
Custom textTakes a specific texttext
Custom text (list)Takes a list in JSON format["Jef", "Frank", "Wilhelm"]