Skip to content

Install: Plex Autoscan

Chaz Larson edited this page Aug 1, 2021 · 57 revisions

Plex Autoscan (by l3uddz) is a script that assists Plex with the adding media files, that were imported by Sonarr / Radarr, by only scanning the folder that has been imported (vs the entire section library folder), thereby preventing Google API bans.

Plex Autoscan comes configured out of the box (as related to Cloudbox). However, there a few things that need to be set by you.

If you would like to learn more about what Plex Autoscan does and all the options available, visit https://github.com/l3uddz/plex_autoscan.

1. Do a One-Time, Manual Scan in Plex

  • For Plex Autoscan to work, at least one item needs to exist in each library before new items can show up.

  • If you already have media, simply add it to the library and do a manual scan within Plex, for each library you have, to build the DB.

  • If you currently don’t have any media, continue on with the setup, and when you have acquired some media, you will then perform a do a manual scan within Plex, for each library, to build the DB.

  • For more info, see this.

2. Add Your Plex Access Token into Plex Autoscan Config

You can skip this step if you entered in your Plex credentials in accounts.yml during setup.

Note: For Mediabox / Feederbox setups, the following will be done on the Mediabox.

  1. Get your Plex Autoscan Token here.

  2. On the server's shell, run the following command:

    nano /opt/plex_autoscan/config/config.json
    
  3. Add the Plex Access Token to "PLEX_TOKEN": so that it now appears as:

    "PLEX_TOKEN": "xxxxxxxxxxxxxx",
    

    Note: Make sure it is within the quotes (") and there is a comma (,) after it.

  4. Ctrl + X Y Enter to save.

3. Obtaining the Plex Autoscan URL

Note: For Mediabox / Feederbox setup, the following will be done on the Mediabox.

The Plex Autoscan URL is needed during the setup of Sonarr, Radarr, and Lidarr.

To get your Plex Autoscan URL, run the following command:

/opt/scripts/plex_autoscan/plex_autoscan_url.sh

This will be in the format of:

http://subdomain.domain.com:plex_autoscan_port/plex_autoscan_pass

or

http://server_ip_address:plex_autoscan_port/plex_autoscan_pass

Example:

http://plex.domain.com:3468/aiG7Uwie9iodTTlaisahcieNaeVonu6I

Note 1: The url will not use plex.domain.com if the IP address it points to does not match the server's IP address (e.g. Cloudflare CDN enabled).

Note 2: If the url is plex.domain.com, but you decide to enable Cloudflare proxy for the plex subdomain later, you will need to generate another Plex Autoscan URL and add that into Sonarr/Radarr/Lidarr instead, as the scan request will need to go to you server's actual IP and not a Cloudflare one.

Note 3: For Mediabox setups, make sure that the port is open in the firewall and/or router.

Note 4: The PAS URL is not meant to be accessed via a browser by default (i.e. going there will give you a 401 Unauthorized error). However, you can enable a web UI for manual scan requests, see here.

4. Upload Control File to Google Drive

The following step is important so that Plex Autoscan can remove missing/replaced media files out of Plex (i.e. empty trash). Without it, Plex will be left with "unavailable" media that can't play (i.e. media posters with trash icons on them).

For more details on what the control file is, see here.

To upload the mounted.bin control file, run the following command:

rclone touch google:/mounted.bin

Note 1: If your Rclone remote config has a different name for Google Drive, replace google: with yours'.

Note 2: Above command requires Rclone version 1.39+

_Note 3: If you use different mount paths for your libraries in Plex this change must also be reflected in /opt/plex_autoscan/config/config.json in SERVER_PATH_MAPPINGS: Example:

    "/mnt/unionfs/Media/Movies/": [
      "/movies/",
      "/mnt/unionfs/Media/Movies/",
      "My Drive/Media/Movies/"
    ],

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 (Choose only one of these)
  3. Settings
  4. Preinstall (Choose only one of these)
  5. SSH
  6. Ansible Vault
  7. Rclone
  8. Cloudbox (Choose only one of these)
  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
  10. Next Steps

Install Feederbox / Mediabox

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

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

Recommended Reading

Backup and Restore

More Information

Advanced Configuration

Experimental

Extras

Misc

Community-Submitted

See Community Wiki.

Reference

Troubleshooting

Links

Clone this wiki locally