-
-
Notifications
You must be signed in to change notification settings - Fork 306
Plex Autoscan Extras
Other options for Plex Autoscan.
In addition to Plex Autoscan receiving scan requests from Sonarr/Radarr/Lidarr, it can also monitor Google Drive directly for updates. When a new file is detected, it is checked against the Plex database and if this file is missing, a new scan request is sent to Plex.
Note: For details on setting up Teamdrives and/or Rclone-crypted remotes, visit https://github.com/l3uddz/plex_autoscan.
To set this up:
-
Edit the config file:
nano /opt/plex_autoscan/config/config.json
-
Under the
GOOGLE
section of the config, enable Google Drive monitoring and fill in your Google Drive API Client ID and Secret."ENABLED": true, "CLIENT_ID": "yourclientid", "CLIENT_SECRET": "yourclientsecret",
-
So that the entire section now looks like this (any order is fine):
"GOOGLE": { "ENABLED": true, "CLIENT_ID": "abcdefgh", "CLIENT_SECRET": "1234567", "ALLOWED": { "FILE_PATHS": [ "My Drive/Media/Movies", "My Drive/Media/TV", "My Drive/Media/Music" ], "FILE_EXTENSIONS": true, "FILE_EXTENSIONS_LIST": [ "webm","mkv","flv","vob","ogv","ogg","drc","gif", "gifv","mng","avi","mov","qt","wmv","yuv","rm", "rmvb","asf","amv","mp4","m4p","m4v","mpg","mp2", "mpeg","mpe","mpv","m2v","m4v","svi","3gp","3g2", "mxf","roq","nsv","f4v","f4p","f4a","f4b","mp3", "flac","ts" ], "MIME_TYPES": true, "MIME_TYPES_LIST": [ "video" ] }, "TEAMDRIVE": false, "TEAMDRIVES": [], "POLL_INTERVAL": 120, "SHOW_CACHE_LOGS": false },
-
Google Drive paths (e.g.
"My Drive/Media/Movies/"
) go underSERVER_PATH_MAPPINGS
and should look like this:Note: This is usually set pre-filled by default.
"SERVER_PATH_MAPPINGS": { "/data/Movies/": [ "/movies/", "/mnt/unionfs/Media/Movies/", "My Drive/Media/Movies/" ], "/data/TV/": [ "/tv/", "/mnt/unionfs/Media/TV/", "My Drive/Media/TV/" ], "/data/Music/": [ "/music/", "/mnt/unionfs/Media/Music/", "My Drive/Media/Music/" ] },
Note: If you are using Scenario 2 Custom Library Setup, you will need to tweak this section of the config.
-
Save and Exit.
-
Next, you will need to authorize Google Drive. To do so, run the following command:
/opt/plex_autoscan/scan.py authorize
-
Visit the link shown to get the authorization code and paste that in and hit
enter
.Visit https://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=&access_type=offline and authorize against the account you wish to use Enter authorization code:
-
When access token retrieval is successfull, you'll see this:
2018-06-24 05:57:58,252 - INFO - GDRIVE [140007964366656]: Requesting access token for auth code '4/AAAfPHmX9H_kMkMasfdsdfE4r8ImXI_BddbLF-eoCOPsdfasdfHBBzffKto' 2018-06-24 05:57:58,509 - INFO - GDRIVE [140007964366656]: Retrieved first access token! 2018-06-24 05:57:58,511 - INFO - AUTOSCAN [140007964366656]: Access tokens were successfully retrieved!
Note: Ignore any
Segmentation fault
messages. -
Restart the service:
sudo systemctl restart plex_autoscan
-
Plex Autoscan will now start monitoring Google Drive.
Setup instructions:
-
Enable
SERVER_ALLOW_MANUAL_SCAN
in your/opt/plex_autoscan/config/config.json
file."SERVER_ALLOW_MANUAL_SCAN": true,
-
Visit your Plex Autoscan URL webpage.
-
Enter in the path to scan.
Note: The path can be in any form (e.g.
/data/Media/...
,/mnt/unionfs/Media/...
,My Drive/Media/....
). The 'Server Path Mappings' will redirect the scan to the correct location. -
The request will now show up under Plex Autoscan logs.
-
Initiate a scan request via curl or equivalent tool:
Note: The path can be in any form (e.g.
/data/Media/...
,/mnt/unionfs/Media/...
,My Drive/Media/....
). The 'Server Path Mappings' will redirect the scan to the correct location.Format:
curl -d "eventType=Manual&filepath=<PATH TO FILE/FOLDER>" <YOUR PLEX AUTOSCAN URL>
-
Examples:
curl -d "eventType=Manual&filepath=/mnt/unionfs/Media/Movies/Shut In (2016)/Shut In (2016) - Bluray-1080p.x264.DTS-GECKOS.mkv" http://ipaddress:3468/0c1fa3c9867e48b1bb3aa055cb86`
curl -d "eventType=Manual&filepath=/data/Movies/Shut In (2016)/Shut In (2016) - Bluray-1080p.x264.DTS-GECKOS.mkv" http://ipaddress:3468/0c1fa3c9867e48b1bb3aa055cb86`
-
The request will now show up under Plex Autoscan logs.
For more details on both options, see here.
Note 1: This is only done on the box where Plex is installed.
Note 2: The path used here has to be exactly what Plex uses for its library.
Note 3: This method does not use Plex Autoscan, and therefore, Plex will immediately start scanning the given paths.
Note: Replace <section ID>
(Plex Library Section IDs) and <plex library's movie/tv show path>
with yours.
docker exec -u plex -i plex bash -c 'export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section <section ID> --directory '"'"'<movie or tv show path>'"'"''
Movie (Section ID 1)
docker exec -u plex -i plex bash -c 'export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 1 --directory '"'"'/data/Movies/The Predator (2018)/'"'"''
TV Show (Section ID 2)
docker exec -u plex -i plex bash -c 'export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory '"'"'/data/TV/The Walking Dead/'"'"''
TV Show with specific season scanned (Section ID 2)
docker exec -u plex -i plex bash -c 'export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory '"'"'/data/TV/Marvels Daredevil/Season 03/'"'"''
- Overview
- Presumptions
- Server
- Domain Name
- Cloudflare
- Cloud Storage
- Plex / Emby - Account
- Usenet vs. BitTorrent
Cloudbox
- Overview
- Dependencies (Choose only one of these)
- Settings
- Preinstall (Choose only one of these)
- SSH
- Ansible Vault
- Rclone
- Cloudbox (Choose only one of these)
- Application Setup
- Next Steps
Feederbox (do this first)
- Overview
- Dependencies
- Settings
- Preinstall
- SSH
- Ansible Vault
- Rclone
- Feederbox (Choose only one of these)
- Application Setup
- Next Steps
Mediabox
- Overview
- Dependencies
- Settings
- Preinstall
- SSH
- Ansible Vault
- Rclone
- Mediabox (Choose only one of these)
- Application Setup
- Next Steps
- Cloudplow (Media Uploader)
- cb utility script (Develop branch only}
- Updating Cloudbox (Choose only one of these)
- Updating Cloudbox Apps
- Removing Cloudbox Apps
- Resetting Cloudbox Apps
- Migrating Cloudbox
- Settings Updater
- Ansible Vault Primer
- Plex Access Token
- Plex Autoscan Extras
- Pushover
- Google Drive API Client ID and Client Secret
- Useful Docker Commands
- Add Your Own Docker Container into Cloudbox
- Revoking SSL Certificates
- Feeder Mount
- Adding a Subdomain
- HTTP Auth Support
- Emby
- Nextcloud
- Resilio Sync
- Plex DupeFinder
- Heimdall
- NZBHydra v1
- Plex Requests
- Sickbeard MP4 Automator
- SABnzbd
- Traktarr
See Community Wiki.