Overview
I am moving from one homelab to another and experiencing various troubles in the process. One issue I had was moving from a poorly managed Plex server to a new Radarr/Sonarr/Lidarr managed one; specifically because I didn't want to "add movie" 2500 times. I discovered it wasn't very straight forward to add movies into Radarr by list, and here we are.
Main Flow
Plex DB > Query for IMDB IDs > Regex > trakt-import-tool > trakt > radarr netImports
Before
In order to perform this process you'll need:
- Access to your Plex server, mine is on a Linux box so the following instructions will be for the Debian distribution of Plex Media Server.
- A Database editing software such as Datagrip or anything that can view SQLite
- A Trakt account
- https://github.com/xbgmsharp/trakt
During
Getting your Plex database
For Debian this is:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
You'll need to extract this somewhere to use with your DB IDE or open it straight from there. For DataGrip, you need to open the Databases console and add it directly to there as a SQL database.
Using your Plex database
The goal here is to obtain all of your IMDB IDs. These are stored as bulky strings in GUID metadata for all movies in the Plex database. An example: com.plexapp.agents.imdb://tt0000000?lang=en
Linux/OSX one-liner
Update the database location to suit
sqlite3 com.plexapp.plugins.library.db "select guid from metadata_items where guid like 'com.plexapp.agents.imdb%';" | grep -P 'tt\d+' -o > movies.txt
Or: Step by step
The query I used to get all of my movies:
select guid from metadata_items
where guid like 'com.plexapp.agents.imdb%';
Regex to one ID per line
There's probably a much better way to do this, but the trakt import tool wants your Ids in a format like:
tt000000
tt000000
tt000000
I copied the output of my query into Sublime Text. Did did the following regex-enabled replace-all:
-
Find: com.plexapp.agents.imdb:// replace:
-
Find: ?lang=en replace:
-
Save to known location
Create Trakt account and developer app.
-
Create a new Trakt account
-
Create a new developer account, I used the example URI for the redirect URI. You won't need the extra permissions, the redirect URI, nor the cors origins for this.
-
Note your client_id and client_secret
Use xbgmsharp trakt import tool
I wasn't really certain of the best way to import to trakt using a static list of IMDB Ids ( given that's really the most information we can get from Plex ). At which time I stumbled upon this tool: https://github.com/xbgmsharp/trakt
- Follow the "usage" instructions on the first page to setup the tool. You have to use the export_trakt.py in order to create your config and use the import_trakt.py. You'll need your client_id and client_secret from the last step.
1.1 Run export_trakt.py to generate the config
1.2 Edit the generated config with your client information
1.3 Run export_traky.py to generate your o_auth key using PIN verification
1.4. Edit the generated config with your o_auth key
- Use the import tool to import your file to your Trakt account watchlist:
python ./import_trakt.py -c config.ini -f imdb -t movies -i your_edited_imdb_file -l watchlist
Import to Radarr
-
Go to settings > lists > add > trakt list
-
Enter your username, change list type to userwatchlist, set folder, hit go
Find more information on the import here: https://github.com/Radarr/Radarr/wiki/Supported-NetImports#traktimport
After
I realized I would probably never do this again and wanted to clean up after myself. Don't forget to:
-
Remove the import tool however you downloaded it
-
I disabled the Trakt account I created
-
Delete the DB file and clean up your IDE
-
Delete the IMDB file
Getting Started
Troubleshooting
- AppData Directory
- Clear Cache Cookies and Local Storage
- Common Problems
- Health Checks
- Remote Path Mappings explained
- How to make sure Radarr doesn't snatch full Blu-Rays
Additional Configuration
- AppData Directory
- Custom Post Processing Scripts
- Built In Qualities
- Custom Formats
- Installing Multiple Instances of Radarr on Windows
- Supported NetImports
- Supported Notifications
- Reverse Proxy
- Release Branches
- Sorting and Renaming
- Twitter Notifications
- Webhook
- Webhook Schema