-
Notifications
You must be signed in to change notification settings - Fork 1
Plex Collection Content Ratings
Script to mass-update Content Ratings of collections based on their contents
Scans your Plex collections, and updates the Colection content rating to match the 'lowest' rating of the films within the collection
Use this tool when you have Content Rating restricted profiles on your Plex server. This will ensure that collections containing a mixture of content ratings will still be available if at least 1 item matches the Content Rating restriction.
Note: This Doesn't mean the restricted user will see the restricted items - they will see the Collection, along with any items that meet the profile limit.
Here, my Harry Potter has a Content Rating of gb/12 (Unsuitable for those under 12). Although some of the films are indeed a 12, some of the are PG.
But because the collection is marked as a 12, and profile which is restricted to gb/PG (Parental Guidance) will not see the collection, or any of the films within it.
By updating the collection to PG, the restricted user will see the Collection, and any films within that collection that are not restricted for them.
This script will scan all items in the collection, and update the collection to the lowest rated film
The main one Smart Collections. They do not 'contain' items in the same way standard collections do, so it's not currently possible to scan the contents to update the rating. And you probably wouldn't want to, as by nature these smart collections can change more often than you might execute this script.
Edit the below parameters of the script, and run it!
I would strongly recommend running it in DRY_MODE
first, and also consider applying a LIMIT
as well for your initial run, in order you can verify the changes being proposed/made.
The local IP address of your Plex instance along with the correct port (usually 32400)
Example: 'http://192.168.1.208:32400'
Your Plex Authentication Token
See Finding an authentication token / X-Plex-Token
Example: token = 'AAA1bcdE23FghijkLmno'
Here is where you need to tell the script what ratings to look out for, and what order to apply them.
The are comprised of a series of pair values; the Content Rating as Plex displays it in the detail pane, and a numerical value you apply to it.
The numerical value can be any number from 0-99, but ensure you have them in the order you want them applied (so most restricted = highest value)
Note: If you want to invert the behaviour of the script, and allways default to the highest content rating for the collection, just modify the ordering here
Example:
ratings_rank = {
"gb/E" : 00,
"gb/Uc" : 10,
"gb/U" : 20,
"gb/PG" : 30,
"gb/12A" : 40,
"gb/12" : 50,
"gb/15" : 60,
"gb/18" : 70
}
Set to True | False
to run the script in Dry Mode.
When True
, the script will output the proposed changes, but will NOT update Plex
When False
, the script will apply the changes to the collection
Example: DRY_RUN = True
Sets a limit to how many collection should be scanned. Mainly useful for debugging / Dry Running
To set no LIMIT, set the value to None
, and all collections will be scanned
Example 1: LIMIT = None
Example 2: LIMIT = 20
You only need the sonarr_episode_changes.py file.
Open a terminal in the same folder as the file
use the command
[python|python3] plex_collection_content_rating.py
(Requires Python3. I have Python mapped to Python3)
this will display the output directly in the terminal for you to review