1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-21 23:42:23 +00:00
5 Import Plex Movie Database to Radarr
☃ Elliot Shepherd edited this page 2020-03-22 10:44:11 +11:00

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:

  1. 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.
  2. A Database editing software such as Datagrip or anything that can view SQLite
  3. A Trakt account
  4. https://github.com/xbgmsharp/trakt

During

Getting your Plex database

Plex Database Locations

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:

  1. Find: com.plexapp.agents.imdb:// replace:

  2. Find: ?lang=en replace:

  3. Save to known location

Create Trakt account and developer app.

  1. Create a new Trakt account

  2. 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.

  3. 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

  1. 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

  1. 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

  1. Go to settings > lists > add > trakt list

  2. 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:

  1. Remove the import tool however you downloaded it

  2. I disabled the Trakt account I created

  3. Delete the DB file and clean up your IDE

  4. Delete the IMDB file