Plex Autoscan - dibrz/ARMBand GitHub Wiki

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: This does not work on either encrypted drives or TeamDrives.

To set this up:

  1. Edit the config file:

    /opt/plex_autoscan/config/config.json
    
  2. Enable the Google Drive monitoring and fill in your Google Drive API Client ID and Secret.

    "CLIENT_ID": "yourclientid",
    "CLIENT_SECRET": "yourclientsecret",
    "ENABLED": true,
    
  3. Next, you will need to authorize Google Drive.

    /opt/plex_autoscan/scan.py authorize
    
  4. Visit the link shown to get the authorization code and paste that in and hit enter.

    2018-06-24 05:50:14,945 -     INFO -    CONFIG [140446220769088]: Using default setting --loglevel=INFO
    2018-06-24 05:50:14,945 -     INFO -    CONFIG [140446220769088]: Using default setting --cachefile=/opt/plex_autoscan/cache.db
    2018-06-24 05:50:14,945 -     INFO -    CONFIG [140446220769088]: Using default setting --tokenfile=/opt/plex_autoscan/token.json
    2018-06-24 05:50:14,946 -     INFO -    CONFIG [140446220769088]: Using default setting --queuefile=/opt/plex_autoscan/queue.db
    2018-06-24 05:50:14,946 -     INFO -    CONFIG [140446220769088]: Using default setting --logfile=/opt/plex_autoscan/plex_autoscan.log
    2018-06-24 05:50:14,946 -     INFO -    CONFIG [140446220769088]: Using default setting --config=/opt/plex_autoscan/config/config.json
    2018-06-24 05:50:15,222 -     INFO -  AUTOSCAN [140446220769088]:
          _                         _
    _ __ | | _____  __   __ _ _   _| |_ ___  ___  ___ __ _ _ __
    | '_ \| |/ _ \ \/ /  / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
    | |_) | |  __/>  <  | (_| | |_| | || (_) \__ \ (_| (_| | | | |
    | .__/|_|\___/_/\_\  \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
    |_|
    
    #########################################################################
    # Author:   l3uddz                                                      #
    # URL:      https://github.com/l3uddz/plex_autoscan                     #
    # --                                                                    #
    # Part of the Cloudbox project: https://cloudbox.rocks                  #
    #########################################################################
    # GNU General Public License v3.0                                       #
    #########################################################################
    
    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:
    
  5. 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!
    
  6. Google Drive paths in SERVER_PATH_MAPPINGS will look like this:

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

  7. Plex Autoscan will now start monitoring Google Drive.