A Python script for checking your Radarr database against Collections and People's careers on TMDB.
This downloads information directly from the Movie's TMDB page and Collections are strictly limited to sequels. For example, with Dark Knight (2008) in my database, this will look at the attached collection information, check the Radarr database for Batman Begins (2005) and The Dark Knight Rises (2012) and can either automatically add any missing into the database or save as a list for manual browsing.
People can also be monitored to automatically find missing Movies from their Acting, Writng, Directing, and / or Production credits as listed on their TMDB page.
Jump to:
- Automatically added into Radarr or save results to text file.
- Add Monitored or Unmonitored.
- Trigger search when added.
- Follow People and grab everything with / by them.
- People only mode - disable scanning collections.
- Movie exclusions
- Ignore missing movies, only check movies that have files.
- Ignore unmonitored movies.
- Blacklist of movies to reject.
- Exclude movies on Radarr's exclusion list.
- Exclude results by minimum ratings and votes.
- Exclude unannounced / preproduction movies that have a release year 0 (on by default)
- Radarr
- Your own TMDB API key.
Getting a TMDB API key: TMDB offers free API keys to anyone with an account. Simply sign up and request a key via your account settings.
The config folder can be named and placed anywhere on your computer and the directory path must be specified when running the command.
In the config folder, make a copy of rcm.default.conf
, rename it rcm.conf
and open it with any text editor.
- server - Address used to access Radarr, usually only
host:port
. Can behost:port/end
,domain/end
or anything as needed for reverse proxied setups. - api_key - Can be found under Settings > General.
- ssl [
True
|False
] - Addhttps://
instead ofhttp://
before the server setting when putting the Radarr URL together. - docker [
True
|False
] - Forces a linux style directory path for when running from Windows with Radarr in a Docker or on a remote linux machine.
- api_key - Your TMDB API (v3) key.
Settings for automatic adding into Radarr. If using, the first time you run the script it is reccomended to have both set to False. This will find a lot of movies on the first run and having it autosearch all of these is a bad idea, having them unmonitored makes them easier to filter in Radarr.
- monitored [
True
|False
] - Add new movies monitored. - autosearch [
True
|False
] - Automatically run a historical / backlog search when added. - profile is the TMDB ID number of a Movie in your database that will be used to copy the Profile and Root Path from when adding movies via People Monitoring and as a back-up for single scan mode if no movies in the collection are in the database. You need to find a movie in Radarr that has the root folder and profile that you want to copy and take the number from the end of the web address,
localhost:7878/movies/name-of-movie-#####
. The profile variable has to be a movie TMDB ID number, it cannot be the name of a movie.
- ignore_wanted [
True
|False
] - Only check movies with files. Ignore Wanted list. - ignore_unmonitored [
True
|False
] - Only check monitored movies in Radarr. - column - Minimum width for first column in output files, I had to give it a number to make everything line up so it might as well be here.
- path - Set folder where the two
output
andlogs
folders will be created. Default is to use the current working directory.
While checking for movie information, TMDB ratings and the number of votes that contributed were also included so can be used to reject poorly rated movies. If you only want movies after a certain year, movies before this can also be rejected.
- min_rating - Scale from 0.0 to 10.0
- min_votes - Minimum number of votes
- min_year - Reject movies in collections by earliest release year. Does not apply to people monitoring.
- ignore_zero - [
True
|False
] - Ignore movies that have the year (0)
There are a lot of bad sequels out there. To block a movie from being imported, simply find it on TMDB and grab the ID number from the web address themoviebd.org/movie/#####-name-of-movie
and add it to the blacklist. Alternatively, running the script with automatic adding disabled will list the movie TMDB ID numbers in the results file.
- blacklist - Comma separated list of movie TMDB ID numbers to ignore if missing from the database. For example, to ignore both other Batman movies and only keep the middle one, I would have:
blacklist = 272, 49026
Do you want everything by a certain Actor, Producer, Director or Writer? Grab their TMDB ID number from their TMDB profile page web address themoviebd.org/person/####-name-of-person
and using the template below, select which credits you would like to monitor. Should work with any of the separating headers on their profile page or this list. If monitoring 'Acting' credits, specific charcater names can be set to allow you to reject movies where they are credited as "Himself" or "Herself", if "Uncredited" appears in there, or if you wish to exclude any other role they are credited with.
In the config folder, make a copy of people.default.conf
and rename it people.conf
.
For each person you wish to follow you need to make a new section in people.conf
.
- header The section header should be their name inside [ ].
- id - The person's TMDB ID number.
- monitor - Comma separated list of the roles you wish to follow for that person.
- reject - Comma separated list of specific character names to reject from acting roles, or use "&blank" to reject empty information and "&name" to reject character names that are their real names. Can be anything but must match letter for letter.
- min_year - Reject movies by earliest release year for this person only.
Template:
[NAME]
id = TMDB ID
monitor = Acting, Directing, Production, Writing
reject = &blank, &name, Uncredited, Himself, Herself, Narrator
min_year = 0
Example:
[Quentin Tarantino]
id = 138
monitor = Directing, Production, Writing
reject =
min_year = 0
[Tom Cruise]
id = 500
monitor = Acting
reject = &blank, Uncredited, Himself, Ethan Hunt
min_year = 2000
Local
- Download and extract the zip or clone with git to a location of your choice.
- You may name and place the config folder anywhere on the computer, the given command assumes the folder is still named
config
in the same folder asrcm.py
. - In the config folder, make a copy of
rcm.default.conf
and rename itrcm.conf
, editrcm.conf
for your values and optionally set uppeople.conf
. - In Command Prompt or Terminal, navigate into the downloaded folder and run
python rcm.py ./config
to begin a scan with the default running options. Python v2 and v3 compatible.
Docker Container
- Container written and maintained by Roxedus, and is available here.
docker create \
--name=radarr-collections \
-v <path to data>:/config \
-e PGID=<gid> -e PUID=<uid> \
-e args=CHANGE_ME \
si0972/radarr-collections
The args
enviroment variable refers to the running options.
I know nothing about Docker myself so cannot assist with any related issues, please open issues about the container here.
Running Process
Running without any mode options will default to a full update scan after one full initial scan has completed.
Movies added into Radarr automatically from;
- Collection scans will use the same Profile and Root Folder Path for the whole collection.
- People Monitoring will copy the Profile and Root Folder Path from the movie set in the varibale below.
- Single scan mode will check if any of the collection are already in the database and copy that or copy the people monitoring default if none are found.
You are able to change the mode and output by running as python rcm.py ./config [options]
.
Short | Long | Use |
---|---|---|
-h |
--help |
Displays this help. |
Conflicting | Mode options | |
-f |
--full |
Repeat full initial scan - recheck all movies. |
-u |
--up |
Reduced update scan - only check recently added items. |
-p |
--people |
People only mode - disable all collection scanning |
-t <num> |
--tmdbid <num> |
Single scan mode - check single TMDB ID for Collections. |
-s <num> |
--start <num> |
Specify start point - useful for big libraries if errors occur. (forces -f ) |
Independant | Output options | |
-q |
--quiet |
Disables verbose logging in command line. Log file still created. |
-n |
--nolog |
Disables log file creation. Verbose logging still visible. |
-e |
--exclude |
Movies on Radarr's exclusion list will be ignored and won't be added to the datbase. |
-c |
--cache |
Disables automatic adding to Radarr, instead saves list of missing movies to text file. |
Multiple options can be passed in, in any order. python rcm.py ./config -c -n -f
would work for example.
The first time the script is run, or when running with the -f
option, every movie in your Radarr database will be checked for collections, then your monitored people if set up. After this complete scan, it will save a list of all the movie TMDB ID numbers in your Radarr database and all the Collection ID numbers discovered.
Running the script after this data is saved will perform an update scan, only checking movies that have been added to the Radarr database since and then rechecking the previously found collections and your monitored people for any new additions. If you delete any or all of the movies in a collection from Radarr without adding them to the blacklist, the update scan will still remember the collection and try to re-add the movies. The only way to remove an entire collection from memory is to re-run the initial scan.
As new movies don't come out very often, running with the -u
options allows you to check collections for newly added movies in Radarr without rechecking the saved collections or your monitored people. This is an ideal scan mode to schedule at short intervals to keep all movies added into Radarr checked.
When running with the -t <num>
option, this will only run a collection check for that movie then stop. Designed for use with ignore_wanted = true
, single scan mode can be set up as a post processing script in Radarr to automatically check collections as files are downloaded.
If you do not wish to check your Radarr database against collection information and are only interested in searching people's careers, collection scanning can be skipped by running with the -p
option.
Traceback ..... ImportError: No module named XXXX
- You do not have the 'requests' or 'configparser' Python module(s) installed.
- unix
pip install requests configparser
- Windows
python -m pip install requests configparser
Traceback ..... KeyError: XXX
- Please update your config files to the latest version
Failed to add: [response code: 200]
- This error occurs when the URL in the config is not accurate enough, usually due to missing the reverse proxy URL base. While the script has been able to read your database, the API is very specific when adding information.
To automate running a scan at set intervals, please use your inbuilt OS scheduling tool to run the command. Please be aware that once the full initial scan has run, the full update scan is unlikely to find new movies very often and that this script makes one API call to TMDB per movie, collection and person that it checks. While their network can probably handle it, it just seems like a waste to be repeatedly making thousands of data requests per run when new sequels are only announced every few years and it takes months of people's time to make or be in something. I personally have it set up with two scheduled tasks, one running the Reduced update scan every day to keep new additions to the database checked and the other running a full update scan only once a fortnight to sync all my monitored collections and people.
When running with the -c
option, no movies will be automatically added into Radarr. Instead, found_date_time.txt is the scan results file that lists the movies that have been found. It is not created if 0 movies are found. A comma separated list of all the TMDB ID numbers found is also added at the end of the file. This allows you to run the scan once to list everything you are missing, add all the movies from the list that you want, then run the scan a second time and use the new list to paste into your rcm.conf file in the blacklist. Be sure to check there is a comma between the end of what is already there and what you paste in.
Example:
Total Movies Found: 2
From Collections: 1
The Dark Knight Collection TMDB ID: 272 Batman Begins (2005)
From People: 1
Quentin Tarantino - Directing - Director TMDB ID: 187 Sin City (2005)
Blacklist entry for all movies:
blacklist = 272, 187