Skip to content

Plex Autoscan Extras

desimaniac edited this page Jun 25, 2019 · 37 revisions

Other options for Plex Autoscan.

Google Drive Monitoring

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:

  1. Edit the config file:

    /opt/plex_autoscan/config/config.json
  2. 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",
  3. 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
    },
  4. Google Drive paths (e.g. "My Drive/Media/Movies/") go under SERVER_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.

  5. Save and Exit.

  6. Next, you will need to authorize Google Drive. To do so, run the following command:

    /opt/plex_autoscan/scan.py authorize
  7. 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:
    
  8. 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.

  9. Restart the service:

    sudo systemctl restart plex_autoscan
  10. Plex Autoscan will now start monitoring Google Drive.

Make Plex scan a specific file or folder

Web app

Setup instructions:

  1. Enable SERVER_ALLOW_MANUAL_SCAN in your /opt/plex_autoscan/config/config.json file.

    "SERVER_ALLOW_MANUAL_SCAN": true, 
  2. Visit your Plex Autoscan URL webpage.

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

  4. The request will now show up under Plex Autoscan logs.

HTTP

  1. 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>
    
  2. 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`
  3. The request will now show up under Plex Autoscan logs.

For more details on both options, see here.

CLI

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.

Command

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>'"'"''

Examples

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/'"'"''

Home

Basics

  1. Introduction
  2. Cloudbox Install Types
  3. Cloudbox Paths
  4. Accessing Cloudbox Apps

Prerequisites

  1. Overview
  2. Presumptions
  3. Server
  4. Domain Name
  5. Cloudflare
  6. Cloud Storage
  7. Plex / Emby - Account
  8. Usenet vs. BitTorrent

Install Cloudbox

Cloudbox
  1. Overview
  2. Dependencies
  3. Ansible Vault
  4. Settings
  5. Preinstall
  6. SSH
  7. Rclone
  8. Cloudbox
  9. Application Setup
    1. NZBGet
    2. ruTorrent
    3. NZBHydra2
    4. Jackett
    5. Plex Media Server
    6. Plex Autoscan
    7. Sonarr
    8. Radarr
    9. Lidarr
    10. PlexPy (Tautulli)
    11. Ombi
    12. Portainer
    13. Organizr

Install Mediabox / Feederbox

Feederbox (do this first)
  1. Overview
  2. Dependencies
  3. Ansible Vault
  4. Settings
  5. Preinstall
  6. SSH
  7. Rclone
  8. Feederbox
  9. Application Setup
    1. NZBGet
    2. ruTorrent
    3. NZBHydra2
    4. Jackett
    5. Sonarr
    6. Radarr
    7. Lidarr
    8. Portainer
    9. Organizr

Mediabox
  1. Overview
  2. Dependencies
  3. Ansible Vault
  4. Settings
  5. Preinstall
  6. SSH
  7. Rclone
  8. Mediabox
  9. Application Setup
    1. Feeder Mount
    2. Plex Media Server
    3. Plex Autoscan
    4. PlexPy (Tautulli)
    5. Ombi

Recommended Reading

Backup and Restore

More Information

Advanced Configuration

Experimental

Extras

Docs coming soon for ...

  • Radarr4K
  • Sonarr4K

Misc Guides

Reference

Troubleshooting

Links

Community Project

Clone this wiki locally
You can’t perform that action at this time.