Skip to content

Instantly share code, notes, and snippets.

@zdimension
Created August 4, 2020 22:50
Show Gist options
  • Save zdimension/ebfcba60ca13ff93607ab37a515585e5 to your computer and use it in GitHub Desktop.
Save zdimension/ebfcba60ca13ff93607ab37a515585e5 to your computer and use it in GitHub Desktop.
Small PHP script that allows importing a Plex library directly into Radarr
<?php
// put this file in a web-served directory with a server that handles PHP files
// use the URL of the field as the "Trakt API" URL in Radarr
// (e.g. http://yourserver/somepath/gen.php)
// put your Plex library path here (escape eventual spaces using backslashes)
$res = `sqlite3 /storage/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db "select guid from metadata_items where guid like 'com.plexapp.agents.imdb%';" | grep -P 'tt\d+' -o`;
$movies = explode("\n", $res);
echo json_encode(array_map(function($item) {
return [
"ids" => [
"imdb" => $item
]
];
}, array_filter($movies, function($movie) {
return $movie;
})));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment