Giter Site home page Giter Site logo

l3uddz / plex_autoscan Goto Github PK

View Code? Open in Web Editor NEW
398.0 31.0 71.0 473 KB

Script to assist sonarr/radarr with plex imports. Will only scan the folder that has been imported, instead of the whole library section.

License: GNU General Public License v3.0

Python 98.70% Shell 1.30%

plex_autoscan's Introduction

Plex Autoscan

made-with-python License: GPL v3 last commit (develop) Discord Contributing Donate



Introduction

Plex Autoscan is a python script that assists in the importing of Sonarr, Radarr, and Lidarr downloads into Plex Media Server.

It does this by creating a web server to accept webhook requests from these apps, and in turn, sends a scan request to Plex. Plex will then only scan the parent folder (i.e. season folder for TV shows, movie folder for movies, and album folders for music) of the media file (versus scanning the entire library folder).

In addition to the above, Plex Autoscan can also monitor Google Drive 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 (see section below).

Plex Autoscan is installed on the same server as the Plex Media Server.

Requirements

  1. Any OS that supports Python.

  2. Python 2.7 or higher (sudo apt install python python-pip).

  3. requirements.txt modules (see below).

Installation

Ubuntu/Debian

  1. cd /opt

  2. sudo git clone https://github.com/l3uddz/plex_autoscan

  3. sudo chown -R user:group plex_autoscan - Run id to find your user / group.

  4. cd plex_autoscan

  5. sudo python -m pip install -r requirements.txt

  6. python scan.py sections - Run once to generate a default config.json file.

  7. Edit /opt/plex_autoscan/config/config.json - Configure settings (do this before moving on).

  8. Edit /opt/plex_autoscan/system/plex_autoscan.service - Change two instances of YOUR_USER to your user and group (do this before moving on).

  9. sudo cp /opt/plex_autoscan/system/plex_autoscan.service /etc/systemd/system/

  10. sudo systemctl daemon-reload

  11. sudo systemctl enable plex_autoscan.service

  12. sudo systemctl start plex_autoscan.service

Windows

Note: It's recommended that you install Rclone and Python using chocolatey.

Configuration

Note: Changes to config file require a restart of the Plex Autoscan service (e.g. sudo systemctl restart plex_autoscan.service in Ubuntu).

Example

Ubuntu/Debian

{
  "DOCKER_NAME": "plex",
  "GOOGLE": {
    "ENABLED": false,
    "CLIENT_ID": "",
    "CLIENT_SECRET": "",
    "ALLOWED": {
      "FILE_PATHS": [],
      "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": 60,
    "SHOW_CACHE_LOGS": false
  },
  "PLEX_ANALYZE_DIRECTORY": true,
  "PLEX_ANALYZE_TYPE": "basic",
  "PLEX_FIX_MISMATCHED": false,
  "PLEX_FIX_MISMATCHED_LANG": "en",
  "PLEX_DATABASE_PATH": "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db",
  "PLEX_EMPTY_TRASH": false,
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    "/mnt/unionfs/mounted.bin"
  ],
  "PLEX_EMPTY_TRASH_MAX_FILES": 100,
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false,
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver/lib",
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
  "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support",
  "PLEX_USER": "plex",
  "PLEX_TOKEN": "",
  "PLEX_LOCAL_URL": "http://localhost:32400",
  "PLEX_CHECK_BEFORE_SCAN": false,
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true,
  "RCLONE": {
    "BINARY": "",
    "CONFIG": "",
    "CRYPT_MAPPINGS": {
    },
    "RC_CACHE_REFRESH": {
      "ENABLED": false,  
      "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
        "Media/": [
            "/mnt/rclone/Media/"
        ]      
      },
      "RC_URL": "http://localhost:5572"
    }
  },
  "RUN_COMMAND_BEFORE_SCAN": "",
  "RUN_COMMAND_AFTER_SCAN": "",
  "SERVER_ALLOW_MANUAL_SCAN": false,
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {
      "/mnt/unionfs/media/": [
          "/data/"
      ]
  },
  "SERVER_IGNORE_LIST": [
    "/.grab/",
    ".DS_Store",
    "Thumbs.db"
  ],
  "SERVER_IP": "0.0.0.0",
  "SERVER_MAX_FILE_CHECKS": 10,
  "SERVER_FILE_CHECK_DELAY": 60,
  "SERVER_PASS": "9c4b81fe234e4d6eb9011cefe514d915",
  "SERVER_PATH_MAPPINGS": {
      "/mnt/unionfs/": [
          "/home/seed/media/fused/"
      ]
  },
  "SERVER_PORT": 3468,
  "SERVER_SCAN_DELAY": 180,
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false,
  "SERVER_SCAN_PRIORITIES": {
    "1": [
      "/Movies/"
    ],
    "2": [
      "/TV/"
    ]
  },
  "SERVER_USE_SQLITE": true,
  "USE_DOCKER": false,
  "USE_SUDO": false
}

Windows

_Note: Windows specific differences only shown. This assumes you mounted your rclone mount to G:\

{
  "PLEX_DATABASE_PATH": "%LOCALAPPDATA%\\Plex Media Server\\Plug-in Support\\Databases\\com.plexapp.plugins.library.db",
  "PLEX_SCANNER": "%PROGRAMFILES(X86)%\\Plex\\Plex Media Server\\Plex Media Scanner.exe",
  "PLEX_SUPPORT_DIR": "%LOCALAPPDATA%\\Plex Media Server",
  "PLEX_LD_LIBRARY_PATH": "%LOCALAPPDATA%\\Plex Media Server",
    "RCLONE": {
    "BINARY": "%ChocolateyInstall%\\bin\\rclone.exe",
    "CONFIG": "%HOMEDRIVE%%HOMEPATH%\\.config\\rclone\\rclone.conf",
    "RC_CACHE_REFRESH": {
      "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
        "Media/": [
            "G:\\Media"
        ]
      }
    }
  },
   "SERVER_PATH_MAPPINGS": {
    "G:\\media\\movies\\": [
      "/data/media/movies/"
    ]
  }
}

Basics

"USE_SUDO": true

USE_SUDO - This option is typically used in conjunction with PLEX_USER (e.g. sudo -u plex). Default is true.

  • The user that runs Plex Autoscan needs to be able to sudo without a password, otherwise it cannot execute the PLEX_SCANNER command as plex. If the user cannot sudo without password, set this option to false.

  • If the user that runs Plex Autoscan is able to run the PLEX_SCANNER command without sudo or is installed with the same user account (e.g. plex), you can you can set this to false.

Docker

Docker specific options.

Note: Some of the Docker examples used below are based on the image by plexinc/pms-docker, with /config/ in the container path mapped to /opt/plex/ on the host. Obvious differences are mentioned between PlexInc and LSIO images.

"USE_DOCKER": true,
"DOCKER_NAME": "plex",

USE_DOCKER - Set to true when Plex is in a Docker container. Default is false.

DOCKER_NAME - Name of the Plex docker container. Default is "plex".

Plex Media Server

Plex Media Server options.

Plex Basics

"PLEX_USER": "plex",
"PLEX_TOKEN": "abcdefghijkl",
"PLEX_LOCAL_URL": "http://localhost:32400",
"PLEX_CHECK_BEFORE_SCAN": false,
"PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true,
"PLEX_ANALYZE_TYPE": "basic",
"PLEX_ANALYZE_DIRECTORY": true,
"PLEX_FIX_MISMATCHED": false,
"PLEX_FIX_MISMATCHED_LANG": "en",

PLEX_USER - User account that Plex runs as. This only gets used when either USE_SUDO or USE_DOCKER is set to true.

  • Native Install: User account (on the host) that Plex runs as.

  • Docker Install: User account within the container. Depends on the Docker image being used.

  • Default is "plex".

PLEX_TOKEN - Plex Access Token. This is used for checking Plex's status, emptying trash, or analyzing media.

PLEX_LOCAL_URL - URL of the Plex Media Server. Can be localhost or http/https address.

  • Examples:

    • "http://localhost:32400" (native install; docker with port 32400 exposed)

    • "https://plex.domain.com" (custom domain with reverse proxy enabled)

PLEX_CHECK_BEFORE_SCAN - When set to true, check and wait for Plex to respond before processing a scan request. Default is false.

PLEX_WAIT_FOR_EXTERNAL_SCANNERS - When set to true, wait for other Plex Media Scanner processes to finish, before launching a new one.

  • For hosts running a single Plex Docker instance, this can be left as true.

  • For multiple Plex Docker instances on a host, set this as false.

PLEX_ANALYZE_TYPE - How Plex will analyze the media files that are scanned. Options are off, basic, deep. off will disable analyzing. Default is basic.

PLEX_ANALYZE_DIRECTORY - When set to true, Plex will analyze all the media files in the parent folder (e.g. movie folder, season folder) vs just the newly added file. Default is true.

PLEX_FIX_MISMATCHED - When set to true, Plex Autoscan will attempt to fix an incorrectly matched item in Plex.

  • Plex Autoscan will compare the TVDBID/TMDBID/IMDBID sent by Sonarr/Radarr with what Plex has matched with, and if this match is incorrect, it will autocorrect the match on the item (movie file or TV episode). If the incorrect match is a duplicate entry in Plex, it will auto split the original entry before correcting the match on the new item.

  • This only works when 1) requests come from Sonarr/Radarr, 2) season folders are being used, and 3) all movies and TV shows have their own unique paths.

  • Default is false.

PLEX_FIX_MISMATCHED_LANG - What language to use for TheTVDB agent in Plex.

  • Default is "en".

Plex File Locations

Note: Verify the settings below by running the Plex Section IDs command (see below).

"PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver/lib",
"PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
"PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support",
"PLEX_DATABASE_PATH": "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db",

PLEX_LD_LIBRARY_PATH

  • Native Install: "/usr/lib/plexmediaserver/lib"

  • Docker Install: Path within the container. Depends on the Docker image being used.

PLEX_SCANNER - Location of Plex Media Scanner binary.

  • Native Install: "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner"

  • Docker Install: Path within the container. Depends on the Docker image being used.

PLEX_SUPPORT_DIR - Location of Plex "Application Support" path.

  • Native Install: "/var/lib/plexmediaserver/Library/Application\\ Support"

  • Docker Install: Path within the container. Depends on the Docker image being used.

PLEX_DATABASE_PATH - Location of Plex library database.

  • Native Install: "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"

  • Docker Install: If Plex Autoscan is running directly on the host, this will be the path on the host. If Plex Autoscan is running inside a Plex container (e.g. https://github.com/horjulf/docker-plex_autoscan), this will be a path within the container.

Plex Section IDs

Running the following command, will return a list of Plex Library Names and their corresponding Section IDs (sorted by alphabetically Library Name):

python scan.py sections

This will be in the format of:

SECTION ID #: LIBRARY NAME

Sample output:

 2018-06-23 08:28:27,070 -     INFO -      PLEX [140425529542400]: Using Plex Scanner
  1: Movies
  2: TV

Plex Emptying Trash

When media is upgraded by Sonarr/Radarr/Lidarr, the previous files are then deleted. When Plex gets the scan request after the upgrade, the new media is added in to the library, but the previous media files would still be listed there but labeled as "unavailable".

To remedy this, a trash emptying command needs to be sent to Plex to get rid of these missing files from the library. The options below enable that to happen.

"PLEX_EMPTY_TRASH": true,
"PLEX_EMPTY_TRASH_CONTROL_FILES": [
  "/mnt/unionfs/mounted.bin"
],
"PLEX_EMPTY_TRASH_MAX_FILES": 100,
"PLEX_EMPTY_TRASH_ZERO_DELETED": true,

PLEX_EMPTY_TRASH - When set to true, empty trash of a section after a scan.

PLEX_EMPTY_TRASH_CONTROL_FILES - Only empty trash when this file exists. Useful when media files, located elsewhere, is mounted on the Plex Server host. Can be left blank if not needed.

PLEX_EMPTY_TRASH_MAX_FILES - The maximum amount of missing files to remove from Plex at one emptying trash request. If there are more missing files than the number listed, the emptying trash request is aborted. This is particularly useful when externally mounted media temporarily dismounts and a ton of files go "missing" in Plex. Default is 100.

PLEX_EMPTY_TRASH_ZERO_DELETED - When set to true, Plex Autoscan will always empty the trash on the scanned section, even if there are 0 missing files. If false, trash will only be emptied when the database returns more than 0 deleted items. Default is false.

Plex Autoscan Server

Basics

"SERVER_IP": "0.0.0.0",
"SERVER_PASS": "9c4b81fe234e4d6eb9011cefe514d915",
"SERVER_PORT": 3468,
"SERVER_SCAN_DELAY": 180,
"SERVER_USE_SQLITE": true

SERVER_IP - Server IP that Plex Autoscan will listen on. Default is 0.0.0.0.

  • 0.0.0.0 - Allow remote access (e.g. Sonarr/Radarr/Lidarr running on another/remote server).

  • 127.0.0.1 - Local access only.

SERVER_PORT - Port that Plex Autoscan will listen on.

SERVER_PASS - Plex Autoscan password. Used to authenticate requests from Sonarr/Radarr/Lidarr. Default is a random 32 character string generated during config build.

SERVER_SCAN_DELAY - How long (in seconds) Plex Autoscan will wait before sending a scan request to Plex.

  • This is useful, for example, when you want Plex Autoscan to wait for more episodes of the same TV show to come in before scanning the season folder, resulting in less work for Plex to do by not scanning the same folder multiple times. This works especially well with SERVER_USE_SQLITE enabled.

SERVER_USE_SQLITE - Option to enable a database to store queue requests. Default is true.

  • The benefits to using this are:

    1. Queue will be restored on Plex Autoscan restart, and

    2. Multiple requests to the same folder can be merged into a single folder scan.

  • Example log:

    Already processing '/data/TV/TV-Anime/Persona 5 the Animation/Season 1/Persona 5 the Animation - s01e01 - I am thou, thou art I.mkv' from same folder, aborting adding an extra scan request to the queue.
    Scan request from Sonarr for '/data/TV/TV-Anime/Persona 5 the Animation/Season 1/Persona 5 the Animation - s01e01 - I am thou, thou art I.mkv', sleeping for 180 seconds...
    

    The 180 seconds in the example above are from the SERVER_SCAN_DELAY, if any more requests come in during this time, the scan request will be delayed by another 180 seconds.

Server - Path Mappings

List of paths that will be remapped before being scanned by Plex.

This is particularly useful when receiving scan requests, from a remote Sonarr/Radarr/Lidarr installation, that has different paths for the media.

Native Install

Format:

"SERVER_PATH_MAPPINGS": {
    "/path/on/local/plex/host/": [  <--- Plex Library path
        "/path/on/sonarr/host/"  <--- Sonarr root path
    ]
},

Note: This format is used regardless of whether Sonarr is on the same server as Plex or not.

Example:

"SERVER_PATH_MAPPINGS": {
    "/mnt/unionfs/": [
        "/home/seed/media/fused/"
    ]
},

Docker Install

Format:

"SERVER_PATH_MAPPINGS": {
    "/path/in/plex/container/": [  <--- Plex Library path
        "/path/from/sonarr/container/"  <--- Sonarr root path
    ]
},

Example:

"SERVER_PATH_MAPPINGS": {
  "/data/Movies/": [
    "/movies/"
  ]
}

If the filepath that was reported to Plex Autoscan by Radarr was /home/seed/media/fused/Movies/Die Hard/Die Hard.mkv then the path that would be scanned by Plex would be /mnt/unionfs/Movies/Die Hard/Die Hard.mkv.

Multiple Paths

You can also have more than one folder paths pointing to a single one.

Example:

"SERVER_PATH_MAPPINGS": {
  "/data/Movies/": [
    "/media/movies/",
    "/local/movies/"
  ]
}

Server File Checks

After a SERVER_SCAN_DELAY, Plex Autoscan will check to see if file exists before sending a scan request to Plex.

"SERVER_MAX_FILE_CHECKS": 10,
"SERVER_FILE_CHECK_DELAY": 60,
"SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false,

SERVER_MAX_FILE_CHECKS - The number specifies how many times this check will occur, before giving up. If set to 0, this check will not occur, and Plex Autoscan will simply send the scan request after the SERVER_SCAN_DELAY. Default is 10.

SERVER_FILE_CHECK_DELAY - Delay in seconds between two file checks. Default is 60.

SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION - Plex Autoscan will scan the media folder when the file exist checks (as set above) are exhausted. Default is false.

Server File Exists - Path Mappings

List of paths that will be remapped before file exist checks are done.

This is particularly useful when using Docker, since the folder being scanned by the Plex container, may be different to the path on the host system running Plex Autoscan.

Format:

"SERVER_FILE_EXIST_PATH_MAPPINGS": {
    "/actual/path/on/host/": [
        "/path/from/plex/container/"
    ]
},

Example:

"SERVER_FILE_EXIST_PATH_MAPPINGS": {
    "/mnt/unionfs/media/": [
        "/data/"
    ]
},

You can leave this empty if it is not required:

"SERVER_FILE_EXIST_PATH_MAPPINGS": {
},

Misc

"RUN_COMMAND_BEFORE_SCAN": "",
"RUN_COMMAND_AFTER_SCAN": "",
"SERVER_ALLOW_MANUAL_SCAN": false,
"SERVER_IGNORE_LIST": [
  "/.grab/",
  ".DS_Store",
  "Thumbs.db"
],
"SERVER_SCAN_PRIORITIES": {
  "1": [
    "/Movies/"
  ],
  "2": [
    "/TV/"
  ]
},

RUN_COMMAND_BEFORE_SCAN - If a command is supplied, it is executed before the Plex Media Scanner command.

RUN_COMMAND_AFTER_SCAN - If a command is supplied, it is executed after the Plex Media Scanner, Empty Trash and Analyze commands.

SERVER_ALLOW_MANUAL_SCAN - When enabled, allows GET requests to the webhook URL to allow manual scans on a specific filepath. Default is false.

  • All path mappings and section ID mappings, of the server, apply.

  • This is also a good way of testing your configuration, manually.

  • To send a manual scan, you can either:

    • Visit your webhook url in a browser (e.g. http://ipaddress:3468/0c1fa3c9867e48b1bb3aa055cb86), and fill in the path to scan.

      or

    • Initiate a scan via HTTP (e.g. curl):

      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`
      

SERVER_IGNORE_LIST - List of paths or filenames to ignore when a requests is sent to Plex Autoscan manually (see above). Case sensitive.

  • For example, curl -d "eventType=Manual&filepath=/mnt/unionfs/Media/Movies/Thumbs.db" http://ipaddress:3468/0c1fa3c9867e48b1bb3aa055cb86 would be ignored if Thumbs.db was in the ignore list.

SERVER_SCAN_PRIORITIES - What paths are picked first when multiple scan requests are being processed.

  • Format:
    "SERVER_SCAN_PRIORITIES": {
      "PRIORITY LEVEL#": [
        "/path/to/library/in/Plex"
      ],
    },

Google Drive Monitoring

As mentioned earlier, Plex Autoscan can monitor Google Drive for changes. It does this by utilizing a proactive cache (vs building a cache from start to end).

Once a change is detected, the file will be checked against the Plex database to make sure this is not already there. If this match comes back negative, a scan request for the parent folder is added into the process queue, and if that parent folder is already in the process queue, the duplicate request will be ignored.

"GOOGLE": {
  "ENABLED": false,
  "CLIENT_ID": "",
  "CLIENT_SECRET": "",
  "ALLOWED": {
    "FILE_PATHS": [],
    "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": 60,
  "SHOW_CACHE_LOGS": false
},
"RCLONE": {
  "BINARY": "/usr/bin/rclone",
  "CONFIG": "/home/seed/.config/rclone/rclone.conf",
  "CRYPT_MAPPINGS": {
    "My Drive/encrypt/": [
      "gcrypt:"
    ]
  }
},

ENABLED - Enable or Disable Google Drive Monitoring. Requires one time authorization, see below.

CLIENT_ID - Google Drive API Client ID.

CLIENT_SECRET - Google Drive API Client Secret.

ALLOWED - Specify what paths, extensions, and mime types to whitelist.

  • FILE_PATHS - What paths to monitor.

    • Example ("My Drive" only):

      "FILE_PATHS": [
        "My Drive/Media/Movies/",
        "My Drive/Media/TV/"
      ],
    • Example ("My Drive" with Teamdrives):

      "FILE_PATHS": [
        "My Drive/Media/Movies/",
        "My Drive/Media/TV/",
        "Shared_Movies/Movies/",
        "Shared_Movies/4K_Movies/",
        "Shared_TV/TV/"
      ],
  • FILE_EXTENSIONS - To filter files based on their file extensions. Default is true.

  • FILE_EXTENSIONS_LIST - What file extensions to monitor. Requires FILE_EXTENSIONS to be enabled.

    • Example:

      "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 - To filter files based on their mime types. Default is true.

  • MIME_TYPES_LIST - What file extensions to monitor. Requires MIME_TYPES to be enabled.

    • Example:

      "MIME_TYPES_LIST": [
        "video"
      ]

TEAMDRIVE - Enable or Disable monitoring of changes inside Team Drives. Default is false.

  • Note: For the TEAMDRIVE setting to take effect, you set this to true and run the authorize command (see below).

TEAMDRIVES - What Team Drives to monitor. Requires TEAMDRIVE to be enabled.

  • Format:

    "TEAMDRIVES": [
      "NAME_OF_TEAMDRIVE_1",
      "NAME_OF_TEAMDRIVE_2"
    ],
  • Example:

    For 2 Teamdrives named Shared_Movies and Shared_TV.

    "TEAMDRIVES": [
      "Shared_Movies",
      "Shared_TV"
    ],
  • Note: This is just a list of Teamdrives, not the specific paths within it.

POLL_INTERVAL - How often (in seconds) to check for Google Drive changes.

SHOW_CACHE_LOGS - Show cache messages from Google Drive. Default is false.

BINARY - Path to Rclone binary if not in standard location.

CONFIG - Path to Rclone config file containing Rclone Crypt remote configuration. Required for Rclone Crypt decoder.

CRYPT_MAPPINGS - Mapping of path (root or subfolder) of Google Drive crypt (My Drive/ or Team Drive Name/) to Rclone mount name. These values enable Rclone crypt decoder.

  • Example: Crypt folder on drive called encrypt mapped to Rclone crypt mount called grypt:.

    "CRYPT_MAPPINGS": {
      "My Drive/encrypt/": [
        "gcrypt:"
      ]
    },
  • Example: Crypt Teamdrive named Shared_TV mapped to Rclone crypt mount called Shared_TV_crypt:.

    "CRYPT_MAPPINGS": {
      "Shared_TV/": [
        "Shared_TV_crypt:"
      ]
    },

To set this up:

  1. Edit config.json file, to enable the Google Drive monitoring and fill in your Google Drive API Client ID and Secret.

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

    scan.py authorize
  3. 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:
    
  4. When access token retrieval is successful, 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: Message stating Segmentation fault at the end can be ignored.

  5. You will now need to add in your Google Drive paths into SERVER_PATH_MAPPINGS. This will tell Plex Autoscan to map Google Drive paths to their local counter part.

    i. Native install

    • Format:

      "SERVER_PATH_MAPPINGS": {
          "/path/on/local/host": [
              "/path/on/sonarr/host/",
              "path/on/google/drive/"
          ]
      },

      Note 1: The Google Drive path does not start with a forward slash (/). Paths in My Drive will start with just My Drive/. and paths in a Google Teamdrive will start with teamdrive_name/.

      Note 2: Foreign users of Google Drive might not see My Drive listed on their Google Drive. They can try using the My Drive/... path or see what the log shows and match it up to that. One example is Mon\u00A0Drive/ for French users.

    • For example, if you store your files under My Drive's Media folder (My Drive/Media/...), the server path mappings will look like this:

      "SERVER_PATH_MAPPINGS": {
        "/mnt/unionfs/Media/Movies/": [
          "/home/seed/media/fused/"
          "My Drive/Media/Movies/"
        ],
      },
    • For example, if you store your files under a Google Teamdrive called "shared_movies" and within a Media folder (shared_movies/Media/...), the server path mappings will look like this:

      "SERVER_PATH_MAPPINGS": {
        "/mnt/unionfs/Media/Movies/": [
          "/home/seed/media/fused/"
          "shared_movies/Media/Movies/"
        ],
      },

    ii. Docker install

    • Format:

      "SERVER_PATH_MAPPINGS": {
          "/path/in/plex/container/": [
             "/path/from/sonarr/container/",
             "path/on/google/drive/"
          ]
      },

      Note 1: The Google Drive path does not start with a forward slash (/). Paths in My Drive will start with just My Drive/. and paths in a Google Teamdrive will start with teamdrive_name/.

      Note 2: Foreign users of Google Drive might not see My Drive listed on their Google Drive. They can try using the My Drive/... path or see what the log shows and match it up to that. One example is Mon\u00A0Drive/ for French users.

    • For example, if you store your files under Google Drive's My Drive Media folder (My Drive/Media/...) AND run Plex in a docker container, the server path mappings will look like this:

      "SERVER_PATH_MAPPINGS": {
        "/data/Movies/": [
          "/movies/",
          "My Drive/Media/Movies/"
        ]
      }
    • For example, if you store your files under Google Drive's Teamdrive called "shared_movies" and within a Media folder (shared_movies/Media/...) AND run Plex in a docker container, the server path mappings will look like this:

      • Format:

        "SERVER_PATH_MAPPINGS": {
          "/data/Movies/": [
            "/movies/",
            "NAME_OF_TEAMDRIVE/Media/Movies/"
          ]
        }
      • Example:

        "SERVER_PATH_MAPPINGS": {
          "/data/Movies/": [
            "/movies/",
            "shared_movies/Media/Movies/"
          ]
        }
  6. Rclone Crypt Support - If your mounted Google Drive is encrypted using Rclone Crypt, Plex Autoscan can also decode the filenames for processing changes. This includes drives/team drives entirely encrypted or just a subfolder i.e. in the below example only the encrypt subfolder is encrypted.

    1. Configure Rclone values. Example below:

      "RCLONE": {
        "BINARY": "/usr/bin/rclone",
        "CONFIG": "/home/seed/.config/rclone/rclone.conf",
        "CRYPT_MAPPINGS": {
          "My Drive/encrypt/": [
             "gcrypt:"
          ]
        }
      },
    2. Disable mime type checking in your config file. This is not currently supported with Rclone Crypt Decoding. Rclone crypt encodes file paths and encrypts files causing Google Drive to reports all files in a crypt as '"mimeType": "application/octet-stream"'.

      "MIME_TYPES": false

    3. Add in your Rclone crypt paths on Google Drive into 'SERVER_PATH_MAPPINGS'. This will tell Plex Autoscan to map Rclone crypt paths on Google Drive to their local counter part.

      "SERVER_PATH_MAPPINGS": {
        "/home/seed/media/": [
        "My Drive/encrypt/"
        ]
      },
  7. Google Drive Monitoring is now setup.


Rclone Remote Control

Note: This if for Rclone mounts using the "cache" or "vfs" backends.

When RC_CACHE_REFRESH is enabled, if a file exist check fails (as set in SERVER_FILE_EXIST_PATH_MAPPINGS), Plex Autoscan will keep sending an Rclone cache/expire or vfs/refresh requests, for that file's parent folder, until the file check succeeds.

For example, if the file /mnt/unionfs/Media/A Good Movie (2000)/A Good Movie.mkv doesn't exist locally, then a clear cache request will be sent to the remote for A Good Movie (2000) folder, on the Rclone remote. But if a file exist checks fails again, it will move to the parent folder and try to clear that (eg Media), and keep doing this until a file check exists comes back positive or checks count reaches SERVER_MAX_FILE_CHECKS.

"RCLONE": {
  "RC_CACHE_REFRESH": {
    "ENABLED": false,
    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
      "Media/": [
        "/mnt/unionfs/Media/"
      ]
    },
    "RC_URL": "http://localhost:5572"
  }
},

ENABLED - enable or disable cache clearing.

FILE_EXISTS_TO_REMOTE_MAPPINGS - maps local mount path to Rclone remote one. Used during file exists checks.

  • Format:

    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
      "folder_on_rclone_remote/": [
        "/path/to/locally/mounted/folder/"
      ]
    },

RC_URL - URL and Port Rclone RC is set to.

Setup

Setup instructions to connect Sonarr/Radarr/Lidarr to Plex Autoscan.

Sonarr

  1. Sonarr -> "Settings" -> "Connect".

  2. Add a new "Webhook".

  3. Add the following:

    1. Name: Plex Autoscan

    2. On Grab: No

    3. On Download: Yes

    4. On Upgrade: Yes

    5. On Rename: Yes

    6. Filter Series Tags: Leave Blank

    7. URL: Your Plex Autoscan Webhook URL

    8. Method:POST

    9. Username: Leave Blank

    10. Password: Leave Blank

  4. The settings will look like this:

    Sonarr Plex Autoscan

  5. Click "Save" to add Plex Autoscan.

Radarr

  1. Radarr -> "Settings" -> "Connect".

  2. Add a new "Webhook".

  3. Add the following:

    1. Name: Plex Autoscan

    2. On Grab: No

    3. On Download: Yes

    4. On Upgrade: Yes

    5. On Rename: Yes

    6. Filter Movie Tags: Leave Blank

    7. URL: Your Plex Autoscan Webhook URL

    8. Method:POST

    9. Username: Leave Blank

    10. Password: Leave Blank

  4. The settings will look like this:

    Radarr Plex Autoscan

  5. Click "Save" to add Plex Autoscan.

Lidarr

  1. Lidarr -> "Settings" -> "Connect".

  2. Add a new "Webhook" Notification.

  3. Add the following:

    1. Name: Plex Autoscan

    2. On Grab: No

    3. On Album Import: No

    4. On Track Import: Yes

    5. On Track Upgrade: Yes

    6. On Rename: Yes

    7. Tags: Leave Blank

    8. URL: Your Plex Autoscan Webhook URL

    9. Method:POST

    10. Username: Leave Blank

    11. Password: Leave Blank

  4. The settings will look like this:

    Radarr Plex Autoscan

  5. Click "Save" to add Plex Autoscan.


Donate

If you find this project helpful, feel free to make a small donation to the developer:

plex_autoscan's People

Contributors

beyondmeat avatar chazlarson avatar daghaian avatar dependabot[bot] avatar desimaniac avatar horjulf avatar jusher00 avatar l3uddz avatar m1lkman avatar mza921 avatar saltydk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plex_autoscan's Issues

Auto Scanner Exception

I keep getting the following in my plex_auto_scan logs:

2017-11-02 18:29:09,495 -    ERROR -     UTILS [ 3350]: Exception checking for process: 'Plex Media Scanner': 
Traceback (most recent call last):
  File "/plexscanner/plex_autoscan/utils.py", line 43, in is_process_running
    if process.name().lower() == process_name.lower():
  File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 641, in name
    name = self._proc.name()
  File "/usr/local/lib/python2.7/site-packages/psutil/_psbsd.py", line 504, in wrapper
    raise ZombieProcess(self.pid, self._name, self._ppid)
ZombieProcess: psutil.ZombieProcess process still exists but it's a zombie (pid=1079)

It seems that when I do see that occur artwork for movies don't show up in plex.

having trouble authorizing my google drive

Getting this error when running scan.py to authorize my google drive. Any fix for this or did i do something wrong on the setup?

2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --loglevel=INFO
2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --cachefile=./cache.db
2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --tokenfile=./token.json
2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --queuefile=./queue.db
2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --logfile=./plex_autoscan.log
2018-07-14 05:38:20,965 - INFO - CONFIG [140294149138240]: Using default setting --config=./config/config.json
Traceback (most recent call last):
File "./scan.py", line 56, in
conf.load()
File "/opt/plex_autoscan/config.py", line 233, in load
cfg, upgraded = self.upgrade_settings(json.load(fp))
File "/usr/lib/python2.7/json/init.py", line 291, in load
**kw)
File "/usr/lib/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Invalid control character at: line 4 column 19 (char 59)

Can't run script

Hi there

Getting this error when attempting to run the script as per the readme

● plex_autoscan.service - Plex Autoscan
   Loaded: loaded (/etc/systemd/system/plex_autoscan.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Wed 2018-12-12 20:23:20 AEST; 1s ago
  Process: 30554 ExecStart=/opt/plex_autoscan/scan.py server --loglevel=INFO (code=exited, status=1/FAILURE)
 Main PID: 30554 (code=exited, status=1/FAILURE)

Dec 12 20:23:20 FlixNow1 systemd[1]: plex_autoscan.service: Unit entered failed state.
Dec 12 20:23:20 FlixNow1 systemd[1]: plex_autoscan.service: Failed with result 'exit-code'.

Unfortunately there's not a lot to go on - any help would be great.

Escape special characters in filenames

Just noticed a bug - when there are special characters in the path, it doesn't parse the file correctly.

2017-10-13 04:01:59,445 -    DEBUG -  AUTOSCAN [ 1418]: Client '64.137.231.4' request dump:
{
    ".Link's.Buddy.System-S01E02-Super.Special.Secret.Bike.WEBDL-1080p.mkv": "",
    ".Link's.Buddy.System/Season_01/Rhett.": "",
    "eventType": "Manual",
    "filepath": "/mnt/plexdrive/TV/Rhett."
}

Note the file path is supposed to be /mnt/plexdrive/TV/Rhett.&.Link's.Buddy.System/Season_01/Rhett.&.Link's.Buddy.System-S01E02-Super.Special.Secret.Bike.WEBDL-1080p.mkv

ImportError: cannot import name 'DeleteQuery'

Looks like peewee on py is now version 3.0 thus I'm getting the below errorr

Traceback (most recent call last):
File "/opt/apps/autoscan/scan.py", line 62, in
import db
File "/opt/apps/autoscan/db.py", line 4, in
from peewee import DeleteQuery
ImportError: cannot import name 'DeleteQuery'

No 'Plex Media Scanner' processes were found

Hello!

I think I'm pretty close to getting this working. Here is what I'm seeing when I try and manual scan a recently downloaded file from Sonarr. I tested this same file after autoscan also did not work, same error, just for testing purposes. I have temporarily lowered the scan delay from 180 seconds for the debug process.

 2019-01-09 12:20:28,698 -     INFO -  AUTOSCAN [139776940705536]: Starting queue processor in 10 seconds
 2019-01-09 12:20:28,698 -     INFO -  AUTOSCAN [139777009694528]: Starting server: http://0.0.0.0:3467/6d2439cb1a9d4c048b7fbd251cb049fb
 2019-01-09 12:20:38,703 -     INFO -  AUTOSCAN [139776940705536]: Queue processor started
 2019-01-09 12:20:38,705 -     INFO -      PLEX [139776930141952]: Scan request from Manual for '/home/adam/media/tv/adults/Late Night with Seth Meyers/Season 06/', sleepi$
 2019-01-09 12:20:40,708 -     INFO -  AUTOSCAN [139776940705536]: Restored 1 scan requests from database
 2019-01-09 12:20:43,711 -     INFO -      PLEX [139776930141952]: File '/home/adam/media/tv/adults/Late Night with Seth Meyers/Season 06/' exists on check 1 of 10.
 2019-01-09 12:20:43,712 -     INFO -      PLEX [139776930141952]: Scan request is now being processed
 2019-01-09 12:20:43,732 -     INFO -      PLEX [139776930141952]: No 'Plex Media Scanner' processes were found.
 2019-01-09 12:20:43,732 -     INFO -      PLEX [139776930141952]: Starting Plex Scanner
 2019-01-09 12:20:44,283 -     INFO -      PLEX [139776930141952]: Finished scan!
 2019-01-09 12:20:44,296 -     INFO -      PLEX [139776930141952]: Removed '/home/adam/media/tv/adults/Late Night with Seth Meyers/Season 06/' from database
 2019-01-09 12:20:45,298 -     INFO -      PLEX [139776930141952]: There is 0 queued items remaining...
 2019-01-09 12:20:45,298 -     INFO -      PLEX [139776930141952]: Checking deleted item count in 10 seconds...

Current config, which has the official Plex docker as well as Sonarr/Radarr etc. dockers. All of their mappings are directly matching the host so I don't need to do any remote path config in those apps. Media is at /home/adam/media/ and all downloads live in /downloads/

Thanks!

{
  "DOCKER_NAME": "plex", 
  "GDRIVE": {
    "CLIENT_ID": "", 
    "CLIENT_SECRET": "", 
    "ENABLED": false, 
    "IGNORE_PATHS": [], 
    "POLL_INTERVAL": 60, 
    "SCAN_EXTENSIONS": [
      "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"
    ], 
    "TEAMDRIVE": false
  }, 
  "PLEX_ANALYZE_DIRECTORY": true, 
  "PLEX_ANALYZE_TYPE": "basic", 
  "PLEX_DATABASE_PATH": "/home/adam/docker/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db", 
  "PLEX_EMPTY_TRASH": true, 
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    ""
  ], 
  "PLEX_EMPTY_TRASH_MAX_FILES": 100, 
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false, 
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver", 
  "PLEX_LOCAL_URL": "https://plex:32400", 
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner", 
  "PLEX_SECTION_PATH_MAPPINGS": {
    "10": [
      "/home/adam/media/tv/adults/"
    ],
    "8": [
      "/home/adam/media/tv/kids/"
    ],
    "11": [
      "/home/adam/media/comedy/"
    ],
    "4": [
      "/home/adam/media/anime/"
    ],
    "7": [
      "/home/adam/media/music/"
    ],
    "26": [
      "/home/adam/media/movies4k/"
    ],
    "21": [
      "/home/adam/media/movies/action/"
    ],
    "22": [
      "/home/adam/media/movies/comedy/"
    ],
    "23": [
      "/home/adam/media/movies/crime/"
    ],
    "24": [
      "/home/adam/media/movies/documentary/"
    ],
    "25": [
      "/home/adam/media/movies/drama/"
    ],
    "9": [
      "/home/adam/media/movies/family/"
    ],
    "20": [
      "/home/adam/media/movies/horror/"
    ],
    "19": [
      "/home/adam/media/movies/musical/"
    ],
    "18": [
      "/home/adam/media/movies/romance/"
    ],
    "17": [
      "/home/adam/media/movies/scifi-fantasy/"
    ],
    "16": [
      "/home/adam/media/movies/sport/"
    ],
    "15": [
      "/home/adam/media/movies/superhero/"
    ],
    "14": [
      "/home/adam/media/movies/thriller/"
    ],
    "13": [
      "/home/adam/media/movies/western/"
    ],
    "28": [
      "/home/adam/media/movies/"
    ]
  }, 
  "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support", 
  "PLEX_TOKEN": "xxxxxxxxxxxxxxxxxxxxx", 
  "PLEX_USER": "plex", 
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true, 
  "RCLONE_RC_CACHE_EXPIRE": {
    "ENABLED": false, 
    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
      "Media/": [
        "/home/thompsons/plexdrive/Media"
      ]
    }, 
    "RC_URL": "http://localhost:5572"
  }, 
  "RUN_COMMAND_AFTER_SCAN": "", 
  "RUN_COMMAND_BEFORE_SCAN": "", 
  "SERVER_ALLOW_MANUAL_SCAN": true, 
  "SERVER_FILE_CHECK_DELAY": 60, 
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {
    "/home/adam/media": [
      "/data/"
    ]
  }, 
  "SERVER_IGNORE_LIST": [
    "/.grab/", 
    ".DS_Store", 
    "Thumbs.db"
  ], 
  "SERVER_IP": "0.0.0.0", 
  "SERVER_MAX_FILE_CHECKS": 10, 
  "SERVER_PASS": "6d2439cb1a9d4c048b7fbd251cb049fb", 
  "SERVER_PATH_MAPPINGS": {
    "/home/adam/media/": [
      "/home/adam/media/"
    ]
  }, 
  "SERVER_PORT": 3467, 
  "SERVER_SCAN_DELAY": 5, 
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false, 
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/home/adam/media"
    ]
  }, 
  "SERVER_USE_SQLITE": true, 
  "USE_DOCKER": true, 
  "USE_SUDO": true
}

DEV BRANCH: not able to read filepath from GDrive

Running the dev branch (was previously using the feat/gdrive branch) and I am getting the following errors on any file from GDrive

2018-06-20 07:18:21,916 - INFO - AUTOSCAN [139856868108032]: Starting queue processor in 10 seconds 2018-06-20 07:18:21,917 - INFO - AUTOSCAN [139856932075264]: Starting server: http://0.0.0.0:23477/xxxxxxxxxxxxxxxxxxxxxxxxxxxx 2018-06-20 07:18:21,917 - INFO - AUTOSCAN [139856859715328]: Starting Google Drive changes monitor in 30 seconds... 2018-06-20 07:18:31,920 - INFO - AUTOSCAN [139856868108032]: Queue processor started 2018-06-20 07:18:31,922 - INFO - AUTOSCAN [139856868108032]: Restored 0 scan requests from database 2018-06-20 07:18:51,949 - INFO - AUTOSCAN [139856859715328]: Google Drive access tokens were successfully loaded 2018-06-20 07:18:51,950 - INFO - AUTOSCAN [139856859715328]: Google Drive changes monitor started 2018-06-20 07:18:52,110 - INFO - GDRIVE [139856859715328]: Renewed access token! 2018-06-20 07:18:52,460 - INFO - AUTOSCAN [139856859715328]: There's 21 Google Drive change(s) to process 2018-06-20 07:18:52,462 - INFO - GDRIVE [139856859715328]: Added '160NJuXCyDrAcuzVPTWB2uvaSQEyid7BG' to cache: The Bold Type - S02E03 - The Scarlet Letter WEBDL-1080p tbs.mkv 2018-06-20 07:18:52,463 - ERROR - GDRIVE [139856859715328]: Exception retrieving filepaths for '160NJuXCyDrAcuzVPTWB2uvaSQEyid7BG': Traceback (most recent call last): File "/home/hthighway/plex_autoscan/gdrive.py", line 182, in get_id_file_paths added_to_cache += get_item_paths(item_id, '', file_paths, added_to_cache) File "/home/hthighway/plex_autoscan/gdrive.py", line 175, in get_item_paths new_cache_entries += get_item_paths(parent, path, paths, new_cache_entries) File "/home/hthighway/plex_autoscan/gdrive.py", line 158, in get_item_paths success, obj = self.get_id_metadata(obj_id) File "/home/hthighway/plex_autoscan/gdrive.py", line 137, in get_id_metadata cached_metadata = self._get_cached_metdata(item_id) File "/home/hthighway/plex_autoscan/gdrive.py", line 225, in _get_cached_metdata return self.cache[item_id] File "/usr/local/lib/python2.7/dist-packages/sqlitedict.py", line 246, in __getitem__ return self.decode(item[0]) File "/usr/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode obj, end = self.scan_once(s, idx) TypeError: first argument must be a string, not buffer 2018-06-20 07:18:52,468 - ERROR - GDRIVE [139856859715328]: Exception retrieving filepaths for '1ITT7TXALJLNKY3v52zydL5eRDUq-smir': Traceback (most recent call last): File "/home/hthighway/plex_autoscan/gdrive.py", line 182, in get_id_file_paths added_to_cache += get_item_paths(item_id, '', file_paths, added_to_cache) File "/home/hthighway/plex_autoscan/gdrive.py", line 175, in get_item_paths new_cache_entries += get_item_paths(parent, path, paths, new_cache_entries) File "/home/hthighway/plex_autoscan/gdrive.py", line 158, in get_item_paths success, obj = self.get_id_metadata(obj_id) File "/home/hthighway/plex_autoscan/gdrive.py", line 137, in get_id_metadata cached_metadata = self._get_cached_metdata(item_id) File "/home/hthighway/plex_autoscan/gdrive.py", line 225, in _get_cached_metdata return self.cache[item_id] File "/usr/local/lib/python2.7/dist-packages/sqlitedict.py", line 246, in __getitem__ return self.decode(item[0]) File "/usr/lib/python2.7/json/__init__.py", line 339, in loads return _default_decoder.decode(s) File "/usr/lib/python2.7/json/decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode obj, end = self.scan_once(s, idx) TypeError: first argument must be a string, not buffer

Deletion Support

I noticed that if I delete something on Sonarr/Radarr, Plex won't see that it's been deleted. Would this be possible? I think a few others like renames also didn't work for me either with it sending to plex right away.

Error while loading shared libraries: libva.so.2

So the scripts runs fine, but I get this error:

2019-02-08 11:06:51,045 - INFO - UTILS [140284330137344]: /usr/lib/plexmediaserver/Plex Media Scanner: error while loading shared libraries: libva.so.2: cannot open shared object file: No such file or directory

Seems it cant trigger the scanner looks like it's all good in plex_autoscanner but the scanner is never triggerd in PLEX, this is on a existing install wich used to run fine with no changes.

Anyone experiencing the same, or got a solution?

Rclone authentication

Would it be possible to be able to connect to rclone's rc with a password? I am running this on a box with many users and anyone could find the port I use and run their own commands since it is open locally without authorization.

–rc-htpasswd=file.hpasswd or --rc-user=VALUE
--rc-pass=VALUE would be the commands I'd use to add authentication to rclone's rc

Add more information between Plex Available and Starting Scan

2019-03-12 21:32:21,967 - INFO - PLEX [140463731590912]: Plex is available for scans - (Server Account: [email protected])
2019-03-12 21:32:21,967 - INFO - PLEX [140463731590912]: Starting Plex Scanner

Can we add

2019-03-12 21:32:21,967 - INFO - PLEX [140463731590912]: Processing %filename% after we have checked Plex is available to scan?

unable to authorize google drive

When i run the scan.py authorize i get the following

 2018-11-04 22:55:27,236 -     INFO -    CONFIG [140250178578176]: Using default setting --loglevel=INFO
 2018-11-04 22:55:27,236 -     INFO -    CONFIG [140250178578176]: Using default setting --cachefile=cache.db
 2018-11-04 22:55:27,237 -     INFO -    CONFIG [140250178578176]: Using default setting --tokenfile=token.json
 2018-11-04 22:55:27,237 -     INFO -    CONFIG [140250178578176]: Using default setting --queuefile=queue.db
 2018-11-04 22:55:27,237 -     INFO -    CONFIG [140250178578176]: Using default setting --logfile=plex_autoscan.log
 2018-11-04 22:55:27,237 -     INFO -    CONFIG [140250178578176]: Using default setting --config=config/config.json
Traceback (most recent call last):
  File "scan.py", line 56, in <module>
    conf.load()
  File "/scripts/plex_autoscan/config.py", line 237, in load
    cfg, upgraded = self.upgrade_settings(json.load(fp))
  File "/usr/lib/python2.7/json/__init__.py", line 291, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 89 column 3 (char 1971)

Remote PMS for Windows Configuration Possible?

Hey -

I ran across your scripts today when looking for a solution your project seems to resolve. Currently, I'm using a PowerShell script I wrote within Sonarr, but can't get it to work 100% of the time.

Although a frequent Linux user, I have my Plex Server installed on Windows Server 2016. In addition, the source path for each of its many libraries use drives mapped to a SMB path on a different Windows system which hosts a 43.5tb disk pool.

With that being said, I have a couple of questions, please...

  1. I was planning to install your scripts on one of my Ubuntu servers, but when configuring, I hit a roadblock. Is not it possible to use your current scripts with a Windows-based PMS and/or library source paths located on a Windows system?
  2. If I had PMS on Linux, it seems your scripts must be installed to either the same Linux system running PMS or a Docker container running PMS. Is this correct or could a Linux system remote to where your scripts are installed could be used?

Thank You!

[bug] Not working on windows?

Fresh clone and set-up, i'm always getting:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
    prepare(preparation_data)
  File "C:\Python27\lib\multiprocessing\forking.py", line 510, in prepare
    '__parents_main__', file, path_name, etc
  File "C:\Users\Administrator\AppData\Local\PlexAutoScan\scan.py", line 58, in <module>
    mngr = Manager()
  File "C:\Python27\lib\multiprocessing\__init__.py", line 99, in Manager
    m.start()
  File "C:\Python27\lib\multiprocessing\managers.py", line 524, in start
    self._process.start()
  File "C:\Python27\lib\multiprocessing\process.py", line 130, in start
    self._popen = Popen(self)
  File "C:\Python27\lib\multiprocessing\forking.py", line 258, in __init__
    cmd = get_command_line() + [rhandle]
  File "C:\Python27\lib\multiprocessing\forking.py", line 358, in get_command_line
    is not going to be frozen to produce a Windows executable.''')
RuntimeError:
            Attempt to start a new process before the current process
            has finished its bootstrapping phase.

            This probably means that you are on Windows and you have
            forgotten to use the proper idiom in the main module:

                if __name__ == '__main__':
                    freeze_support()
                    ...

            The "freeze_support()" line can be omitted if the program
            is not going to be frozen to produce a Windows executable.
Traceback (most recent call last):
  File "scan.py", line 58, in <module>
    mngr = Manager()
  File "C:\Python27\lib\multiprocessing\__init__.py", line 99, in Manager
    m.start()
  File "C:\Python27\lib\multiprocessing\managers.py", line 528, in start
    self._address = reader.recv()
EOFError

PLEX_ANALYZE_DIRECTORY not turning off

I have PLEX_ANALYZE_DIRECTORY set to false yet the Plex_Autoscan is still doing an analysis of all the files in the season folders. This is causing my google drive to get banned when I'm updating 3-4 different tv series with one episode.

Here's a snippet of config.json on my server

"PLEX_ANALYZE_DIRECTORY": false, "PLEX_ANALYZE_TYPE": "basic", "PLEX_DATABASE_PATH": "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db", "PLEX_EMPTY_TRASH": false, "PLEX_EMPTY_TRASH_CONTROL_FILES": [ "/mnt/unionfs/mounted.bin" ],

cant seem to get Google drive mappings down

here is my config

"PLEX_SECTION_PATH_MAPPINGS": {
    "8": [
      "/media/gdrive_encrypted/Videos/TV/"
    ], 
    "7": [
      "/media/gdrive_encrypted/Videos/Movies/"
    ],
    "9": [
      "/media/gdrive_encrypted/Videos/Anime/"
    ],
    "4": [
      "/media/gdrive_encrypted/Videos/FrenchTV/"
    ],
    "2": [
      "/media/gdrive_encrypted/Videos/French Movies/"
    ],
    "3": [
      "/media/gdrive_encrypted/Videos/UFC/"
    ],
    "10": [
      "/media/gdrive_encrypted/Videos/Kids-TV/"
    ]
  }, 
"SERVER_PATH_MAPPINGS": {
    "/media/gdrive_encrypted/Videos/Movies": [
      "/Videos/Movies"
    ],
    "/media/gdrive_encrypted/Videos/TV": [
      "/Videos/TV"
    ],
    "/media/gdrive_encrypted/Videos/Anime": [
      "/Videos/Anime"
    ],
    "/media/gdrive_encrypted/Videos/FrenchTV": [
      "/Videos/FrenchTV"
    ],
    "/media/gdrive_encrypted/Videos/French Movies": [
      "/Videos/French Movies"
    ],
    "/media/gdrive_encrypted/Videos/UFC": [
      "/Videos/UFC"
    ],
    "/media/gdrive_encrypted/Videos/Kids-TV": [
      "/Videos/Kids-TV"
    ]
  }, 

Gdrive path is /Videos/... and it is mounted as /media/gdrive_encrypted/Videos

Logs:

2018-11-10 03:51:53,710 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 03:51:53,711 -     INFO -    GDRIVE [139655713601280]: Added '1mFTh3YmZF4fohGRtf2oKkCN4LF_LcjPA' to cache: Infoman - S19E09 - Épisode 9.mp4
 2018-11-10 03:51:54,220 -     INFO -    GDRIVE [139655713601280]: Added '1uWBMO7PoBuUvocTHnliBcq2_64En-3eZ' to cache: Season 19
 2018-11-10 03:51:54,916 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeOTVscGlSNTJHdXc' to cache: Infoman
 2018-11-10 03:51:55,432 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeT0UxeU1jZXdQMTA' to cache: FrenchTV
 2018-11-10 03:51:55,915 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeR2MtNlBVRmJYd00' to cache: Videos
 2018-11-10 03:51:56,400 -     INFO -    GDRIVE [139655713601280]: Added '0AISBUK6Y_ZyeUk9PVA' to cache: My Drive
 2018-11-10 03:51:56,449 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - \xc9pisode 9.mp4']
 2018-11-10 03:51:56,455 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' to database, proceeding with scan
 2018-11-10 03:51:56,455 -     INFO -      PLEX [139655626356480]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4', sleeping for 180 seconds...
 2018-11-10 03:53:57,600 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 03:53:57,600 -     INFO -    GDRIVE [139655713601280]: Added '1etI1x-zeCr6HkpQBI7TkYKqfOp-ThH9D' to cache: Crazy Ex-Girlfriend - S04E05 - I'm So Happy For You.mp4
 2018-11-10 03:53:58,101 -     INFO -    GDRIVE [139655713601280]: Added '18s78Typ2YF3MM4aaulbThEB9snfcl1Iv' to cache: Season 04
 2018-11-10 03:53:58,610 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyecTk5TVVTd2tWTTQ' to cache: Crazy Ex-Girlfriend
 2018-11-10 03:53:59,110 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeTDVBZFVrWk1PYVk' to cache: TV
 2018-11-10 03:53:59,158 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 03:54:56,554 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 03:55:56,615 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 03:56:56,672 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 03:57:56,721 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 03:58:01,439 -     INFO -  AUTOSCAN [139655713601280]: There's 2 Google Drive change(s) to process
 2018-11-10 03:58:01,445 -     INFO -    GDRIVE [139655713601280]: Added '1PaDvqNk-rsH5Jp-MHxYKvSXBzo8VX6Ko' to cache: Blue Bloods - S09E07 - By Hook or By Crook.mp4
 2018-11-10 03:58:01,970 -     INFO -    GDRIVE [139655713601280]: Added '15XE30z-btDnmuLKjvMls3Woa85whgmHW' to cache: Season 09
 2018-11-10 03:58:02,468 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeV1pBcnVfRG5hM3c' to cache: Blue Bloods
 2018-11-10 03:58:02,551 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 03:58:02,551 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - \xc9pisode 9.mp4']
 2018-11-10 03:58:02,552 -     INFO -  AUTOSCAN [139655713601280]: Already processing 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' from same folder, aborting adding an extra scan request to the queue
 2018-11-10 03:58:56,780 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 03:59:03,228 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 03:59:03,267 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - \xc9pisode 9.mp4']
 2018-11-10 03:59:03,267 -     INFO -  AUTOSCAN [139655713601280]: Already processing 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' from same folder, aborting adding an extra scan request to the queue
 2018-11-10 03:59:56,812 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:00:56,872 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:01:56,933 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:02:56,992 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:03:57,039 -  WARNING -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:03:57,042 -     INFO -      PLEX [139655626356480]: Removed 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' from database
 2018-11-10 04:04:06,131 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:04:06,132 -     INFO -    GDRIVE [139655713601280]: Added '1oj9BoUyLGGan7NQ6q2AflmwPK2v3xK6r' to cache: Enquête - S12E08 - Épisode 8.mp4
 2018-11-10 04:04:06,654 -     INFO -    GDRIVE [139655713601280]: Added '1Es2Y6kPYbLg06t8A1TybIP9XqjKLpyO7' to cache: Season 12
 2018-11-10 04:04:07,253 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeU2F3Ym9JMm1nMnM' to cache: Enquête
 2018-11-10 04:04:07,307 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Enqu\xeate/Season 12/Enqu\xeate - S12E08 - \xc9pisode 8.mp4']
 2018-11-10 04:04:07,310 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' to database, proceeding with scan
 2018-11-10 04:04:07,310 -     INFO -      PLEX [139655626356480]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4', sleeping for 180 seconds...
 2018-11-10 04:07:07,409 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:08:07,462 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:09:07,516 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:10:07,568 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:11:07,618 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:12:07,671 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:13:07,724 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:14:07,784 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:14:12,951 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:14:12,951 -     INFO -    GDRIVE [139655713601280]: Added '178a_gfajkjlwKwsUzsho_06o_8dj9oaA' to cache: The Meg (2018) Bluray-1080p.mp4
 2018-11-10 04:14:13,453 -     INFO -    GDRIVE [139655713601280]: Added '1zCK-1ytOjY9lbTk6_K6326IvkTL3WHu9' to cache: The Meg (2018)
 2018-11-10 04:14:13,959 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyeRTJqZTR3c3F2bEU' to cache: Movies
 2018-11-10 04:14:13,994 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4']
 2018-11-10 04:14:13,996 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' to database, proceeding with scan
 2018-11-10 04:14:13,997 -     INFO -      PLEX [139655617963776]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4', sleeping for 180 seconds...
 2018-11-10 04:15:07,844 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:16:07,904 -  WARNING -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:16:07,909 -     INFO -      PLEX [139655626356480]: Removed 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' from database
 2018-11-10 04:17:14,083 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:18:14,143 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:18:16,280 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:18:16,281 -     INFO -    GDRIVE [139655713601280]: Added '1ybT9P1gGNTA8UUr0U-5XLm3948p_G39D' to cache: Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4
 2018-11-10 04:18:16,790 -     INFO -    GDRIVE [139655713601280]: Added '1jeH1Ua1W0cOn8pjrTCHZEHJQTnUsvkts' to cache: Season 05
 2018-11-10 04:18:17,296 -     INFO -    GDRIVE [139655713601280]: Added '0B4SBUK6Y_ZyedXEybld0a3MzUjQ' to cache: Fresh Off the Boat
 2018-11-10 04:18:17,341 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u"My Drive/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4"]
 2018-11-10 04:18:17,345 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' to database, proceeding with scan
 2018-11-10 04:18:17,345 -     INFO -      PLEX [139655626356480]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4', sleeping for 180 seconds...
 2018-11-10 04:19:14,199 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:19:17,940 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:19:17,986 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Enqu\xeate/Season 12/Enqu\xeate - S12E08 - \xc9pisode 8.mp4']
 2018-11-10 04:19:17,990 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' to database, proceeding with scan
 2018-11-10 04:19:17,990 -     INFO -      PLEX [139655609571072]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4', sleeping for 180 seconds...
 2018-11-10 04:20:14,256 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:20:18,599 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:20:18,645 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u"My Drive/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4"]
 2018-11-10 04:20:18,646 -     INFO -  AUTOSCAN [139655713601280]: Already processing 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' from same folder, aborting adding an extra scan request to the queue
 2018-11-10 04:21:14,313 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:21:17,446 -     INFO -      PLEX [139655626356480]: Another scan request occurred for folder of 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4', sleeping again!
 2018-11-10 04:21:17,446 -     INFO -      PLEX [139655626356480]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4', sleeping for 180 seconds...
 2018-11-10 04:21:19,265 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:21:19,266 -     INFO -    GDRIVE [139655713601280]: Added '1cxjDGW3IK9yEL4C5CVq6fF7gDBp_Dc3T' to cache: Clash (2018) - S01E18 - ÉPISODE 18.mp4
 2018-11-10 04:21:19,773 -     INFO -    GDRIVE [139655713601280]: Added '1y7nalqzbQXcQ0hTy_tIjlboxWL7NW-_D' to cache: Season 01
 2018-11-10 04:21:20,283 -     INFO -    GDRIVE [139655713601280]: Added '1U5sQLDvIRleWY63u6CytSSzUK0dsm3JL' to cache: Clash (2018)
 2018-11-10 04:21:20,330 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 04:22:14,372 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:22:18,079 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:22:20,911 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:22:20,954 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 04:23:14,417 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:23:18,134 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:23:21,584 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:23:21,637 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - \xc9pisode 9.mp4']
 2018-11-10 04:23:21,642 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' to database, proceeding with scan
 2018-11-10 04:23:21,642 -     INFO -      PLEX [139655601178368]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4', sleeping for 180 seconds...
 2018-11-10 04:24:14,477 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:24:17,518 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:24:18,194 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:24:22,257 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:24:22,314 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - \xc9pisode 9.mp4']
 2018-11-10 04:24:22,315 -     INFO -  AUTOSCAN [139655713601280]: Already processing 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' from same folder, aborting adding an extra scan request to the queue
 2018-11-10 04:25:14,535 -     INFO -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:25:17,560 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:25:18,244 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:25:22,926 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:25:22,968 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 04:26:14,594 -  WARNING -      PLEX [139655617963776]: File 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:26:14,598 -     INFO -      PLEX [139655617963776]: Removed 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' from database
 2018-11-10 04:26:17,620 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:26:18,304 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:26:21,739 -     INFO -      PLEX [139655601178368]: Another scan request occurred for folder of 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4', sleeping again!
 2018-11-10 04:26:21,740 -     INFO -      PLEX [139655601178368]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4', sleeping for 180 seconds...
 2018-11-10 04:26:23,759 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:26:23,803 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 04:27:17,680 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:27:18,357 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:27:24,432 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:27:24,476 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/FrenchTV/Enqu\xeate/Season 12/Enqu\xeate - S12E08 - \xc9pisode 8.mp4']
 2018-11-10 04:27:24,477 -     INFO -  AUTOSCAN [139655713601280]: Already processing 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' from same folder, aborting adding an extra scan request to the queue
 2018-11-10 04:28:17,723 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:28:18,406 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:29:17,764 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:29:18,464 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:29:21,828 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:30:17,768 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:30:18,514 -     INFO -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:30:21,885 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:31:17,827 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:31:18,572 -  WARNING -      PLEX [139655609571072]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:31:18,575 -     INFO -      PLEX [139655609571072]: Removed 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Enquête/Season 12/Enquête - S12E08 - Épisode 8.mp4' from database
 2018-11-10 04:31:21,942 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:32:17,884 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:32:21,992 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:32:27,633 -     INFO -    GDRIVE [139655713601280]: Renewed access token!
 2018-11-10 04:33:17,944 -  WARNING -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:33:17,947 -     INFO -      PLEX [139655626356480]: Removed 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' from database
 2018-11-10 04:33:22,051 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:34:22,109 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:35:22,170 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:35:29,871 -     INFO -  AUTOSCAN [139655713601280]: There's 1 Google Drive change(s) to process
 2018-11-10 04:35:29,922 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u"My Drive/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4"]
 2018-11-10 04:35:29,926 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' to database, proceeding with scan
 2018-11-10 04:35:29,926 -     INFO -      PLEX [139655626356480]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4', sleeping for 180 seconds...
 2018-11-10 04:36:22,217 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 8 of 10, checking again in 60 seconds.
 2018-11-10 04:37:22,269 -     INFO -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' did not exist on check 9 of 10, checking again in 60 seconds.
 2018-11-10 04:38:22,327 -  WARNING -      PLEX [139655601178368]: File 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' exhausted all available checks, aborting scan request.
 2018-11-10 04:38:22,332 -     INFO -      PLEX [139655601178368]: Removed 'My Drive/media/gdrive_encrypted/Videos/FrenchTV/Infoman/Season 19/Infoman - S19E09 - Épisode 9.mp4' from database
 2018-11-10 04:38:30,024 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 1 of 10, checking again in 60 seconds.
 2018-11-10 04:39:30,085 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 2 of 10, checking again in 60 seconds.
 2018-11-10 04:40:30,145 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 3 of 10, checking again in 60 seconds.
 2018-11-10 04:41:30,204 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 4 of 10, checking again in 60 seconds.
 2018-11-10 04:42:30,251 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 5 of 10, checking again in 60 seconds.
 2018-11-10 04:43:30,306 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 6 of 10, checking again in 60 seconds.
 2018-11-10 04:44:30,364 -     INFO -      PLEX [139655626356480]: File 'My Drive/media/gdrive_encrypted/Videos/TV/Fresh Off the Boat/Season 05/Fresh Off the Boat - S05E05 - Mo' Chinese Mo' Problems.mp4' did not exist on check 7 of 10, checking again in 60 seconds.
 2018-11-10 04:44:35,026 -     INFO -  AUTOSCAN [139655713601280]: There's 2 Google Drive change(s) to process
 2018-11-10 04:44:35,089 -     INFO -  AUTOSCAN [139655713601280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!
 2018-11-10 04:44:35,089 -     INFO -  AUTOSCAN [139655713601280]: Proceeding with scan of 1 file(s) from Google Drive changes: [u'My Drive/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4']
 2018-11-10 04:44:35,094 -     INFO -  AUTOSCAN [139655713601280]: Added 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4' to database, proceeding with scan
 2018-11-10 04:44:35,094 -     INFO -      PLEX [139655601178368]: Scan request from Google Drive for 'My Drive/media/gdrive_encrypted/Videos/Movies/The Meg (2018)/The Meg (2018) Bluray-1080p.mp4', sleeping for 180 seconds...

possible to use without Radarr/Sonarr?

I don't use either services so I was wondering if plex_autoscan would work without them? Is it possible to use an external service to send a POST request to trigger a scan?

401 Error on analyze

The movie shows up but it appears it does not analyze the movie?
Running off cloudbox latest version git pull etc.

2018-02-07 14:35:52,690 - INFO - AUTOSCAN [140026555000576]: Client '172.17.0.11' scan request for movie: '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv', event: 'Download'
2018-02-07 14:35:52,693 - INFO - AUTOSCAN [140026555000576]: Added '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv' to database, proceeding with scan
2018-02-07 14:35:52,694 - INFO - PLEX [140026471708416]: Scan request for '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv', sleeping for 90 seconds...
2018-02-07 14:37:22,785 - INFO - PLEX [140026471708416]: File '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv' exists on check 1 of 10.
2018-02-07 14:37:22,785 - INFO - PLEX [140026471708416]: Scan request is now being processed
2018-02-07 14:37:22,800 - INFO - PLEX [140026471708416]: No 'Plex Media Scanner' processes were found.
2018-02-07 14:37:22,800 - INFO - PLEX [140026471708416]: Starting Plex Scanner
2018-02-07 14:37:28,157 - INFO - UTILS [140026471708416]: GUI: Scanning Wonder (2017)
2018-02-07 14:37:28,496 - INFO - UTILS [140026471708416]: GUI: Matching 'Wonder'
2018-02-07 14:38:03,560 - INFO - UTILS [140026471708416]: GUI: Score for 'Wonder' (2017) is 106
2018-02-07 14:38:03,569 - INFO - UTILS [140026471708416]: GUI: Requesting metadata for 'Wonder'
2018-02-07 14:38:03,582 - INFO - UTILS [140026471708416]: GUI: Background media analysis on Wonder
2018-02-07 14:38:04,099 - INFO - PLEX [140026471708416]: Finished scan!
2018-02-07 14:38:04,100 - INFO - PLEX [140026471708416]: Removed '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv' from database
2018-02-07 14:38:05,101 - INFO - PLEX [140026471708416]: There is 0 queued items remaining...
2018-02-07 14:38:05,101 - INFO - PLEX [140026471708416]: Checking deleted item count in 10 seconds...
2018-02-07 14:38:15,117 - INFO - PLEX [140026471708416]: Skipping emptying trash as there were no deleted items
2018-02-07 14:38:25,129 - INFO - PLEX [140026471708416]: Found row in media_parts where file = '/mnt/unionfs/Media/Movies/movies/Wonder.(2017)/Wonder.(2017).mkv' after 1/5 tries!
2018-02-07 14:38:25,129 - INFO - PLEX [140026471708416]: Sending analyze request for library item: 32425
2018-02-07 14:38:25,687 - ERROR - PLEX [140026471708416]: Unexpected response status_code for analyze request: 401, 1/5 attempts...
2018-02-07 14:38:36,290 - ERROR - PLEX [140026471708416]: Unexpected response status_code for analyze request: 401, 2/5 attempts...
2018-02-07 14:38:46,875 - ERROR - PLEX [140026471708416]: Unexpected response status_code for analyze request: 401, 3/5 attempts...
2018-02-07 14:38:57,431 - ERROR - PLEX [140026471708416]: Unexpected response status_code for analyze request: 401, 4/5 attempts...
2018-02-07 14:39:08,017 - ERROR - PLEX [140026471708416]: Unexpected response status_code for analyze request: 401, 5/5 attempts...

Lidarr - Unknown scan request from: '127.0.0.1'

Lidarr was working with plex_autoscan but has stopped and gives this error in the plex_autoscan logs when Lidarr attempts to trigger a scan.

ERROR - AUTOSCAN [139816710383424]: Unknown scan request from: '127.0.0.1'

It looks like the Lidarr web hook options have changed (as seen below) from what the documentation shows. Is this is a known issue or is it something I can help get working?

image

Sonarr Rename Error

Sonarr: Sonarr Ver. 2.0.0.5163
Ubuntu 16.04 Server

Ran into an error when renaming files shown below:

Apr 09 20:09:44 htpc mono[13536]: [Warn] HttpClient: HTTP Error - Res: [POST] *URLREDACTED*: 400.BadRequest
Apr 09 20:09:44 htpc mono[13536]: [Warn] NotificationService: Unable to send OnRename notification to: Plex Autoscan
Apr 09 20:09:44 htpc mono[13536]: [v2.0.0.5163] NzbDrone.Common.Http.HttpException: HTTP request failed: [400:BadRequest] [POST] at [http://plex.spicypixel.co.uk:3467/4e210bd0216d4906afda744a29a52a24]
Apr 09 20:09:44 htpc mono[13536]:   at NzbDrone.Common.Http.HttpClient.Execute (NzbDrone.Common.Http.HttpRequest request) [0x00128] in <6d548036160a49ed8e2657c617163f50>:0
Apr 09 20:09:44 htpc mono[13536]:   at NzbDrone.Core.Notifications.Webhook.WebhookProxy.SendWebhook (NzbDrone.Core.Notifications.Webhook.WebhookPayload body, NzbDrone.Core.Notifications.Webhook.WebhookSettings settings) [0x0006f] in <9b8bbe29888f49229914613e26af4aa5>:0
Apr 09 20:09:44 htpc mono[13536]:   at NzbDrone.Core.Notifications.Webhook.Webhook.OnRename (NzbDrone.Core.Tv.Series series) [0x0002a] in <9b8bbe29888f49229914613e26af4aa5>:0
Apr 09 20:09:44 htpc mono[13536]:   at NzbDrone.Core.Notifications.NotificationService.Handle (NzbDrone.Core.MediaFiles.Events.SeriesRenamedEvent message) [0x00036] in <9b8bbe29888f49229914613e26af4aa5>:0
Apr 09 20:09:44 htpc mono[13536]: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
Apr 09 20:09:44 htpc mono[13536]: <title>400 Bad Request</title>
Apr 09 20:09:44 htpc mono[13536]: <h1>Bad Request</h1>
Apr 09 20:09:44 htpc mono[13536]: <p>The browser (or proxy) sent a request that this server could not understand.</p>

Seems to only affect rename, new downloads don't suffer this.

Cant connect to local ip

I can just connect to plex_autoscan server with my external ip, I like to have all ports closed on the server for some extra security,

Is this a known issue or just me having troubles?

Integration with sickbeard_mp4_automator

I see there's a closed issue where you offered a barebones Watcher post-processing script to manually call plex_autoscan and I was wondering if it might be possible to get an example for sickbeard_mp4_automator?

I'd really like to disable their built-in Plex update mechanism as it triggers a full library rescan.

Thanks for any help you can offer!

Support updating files

When i update a show or movie with a better version, since the name is the same, plexscan doesnt seem to tell plex to update. Like i had a movie that had only english audio, i replaced it with a dual audio version. The file name stayed the same but i was forced to go in plex and launch a manual analyze to get the file info to change

Feature: Multiple servers to connect to?

I've recently started running plex on a VPS as well as at home, both backed by google drive storage with the home instance being reserved for my own use.

Would it be possible to get autoscan to trigger onto multiple servers?

Google Drive changes monitor starts then does nothing

I think I've misconfigured google drive changes monitor -- I can see the monitor start in syslog, but then it just does nothing:

7 00:47:24,998 - INFO - AUTOSCAN [140120572458752]: Starting server: http://0.0.0.0:3467/5baf69b7a96a49609d4fc│
7 00:47:25,002 - INFO - AUTOSCAN [140120475117312]: Starting Google Drive changes monitor in 30 seconds... │
7 00:47:55,031 - INFO - AUTOSCAN [140120475117312]: Google Drive access tokens were successfully loaded │
7 00:47:55,032 - INFO - AUTOSCAN [140120475117312]: Google Drive changes monitor started

Config file below.

{
  "DOCKER_NAME": "plex", 
  "GDRIVE": {
    "ALLOW_PATHS": ["My Drive/nhk_shows","My Drive/media"], 
    "CLIENT_ID": "NONONO", 
    "CLIENT_SECRET": "NONONO", 
    "ENABLED": true, 
    "IGNORE_PATHS": [], 
    "POLL_INTERVAL": 60, 
    "SCAN_EXTENSIONS": [
      "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"
    ], 
    "SHOW_CACHE_MESSAGES": false, 
    "TEAMDRIVE": false
  }, 
  "PLEX_ANALYZE_DIRECTORY": true, 
  "PLEX_ANALYZE_TYPE": "basic", 
  "PLEX_CHECK_BEFORE_SCAN": false, 
  "PLEX_DATABASE_PATH": "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db", 
  "PLEX_EMPTY_TRASH": false, 
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    ""
  ], 
  "PLEX_EMPTY_TRASH_MAX_FILES": 100, 
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false, 
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver", 
  "PLEX_LOCAL_URL": "http://localhost:32400", 
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner", 
  "PLEX_SECTION_PATH_MAPPINGS": {
    "1": [
      "/media/gdrive/Media/Movies/"
    ], 
    "2": [
      "/media/gdrive/nhk_shows/"
    ], 
    "3": [
      "/media/gdrive/Media/TV/"
    ]
  }, 
  "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support", 
  "PLEX_TOKEN": "", 
  "PLEX_USER": "plex", 
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true, 
  "RCLONE_RC_CACHE_EXPIRE": {
    "ENABLED": false, 
    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
      "Media/": [
        "/mnt/gdrive/Media/"
      ],
      "nhk_shows/": [
        "/mnt/gdrive/nhk_shows/"
      ]
    }, 
    "RC_URL": "http://localhost:5572"
  }, 
  "RUN_COMMAND_AFTER_SCAN": "", 
  "RUN_COMMAND_BEFORE_SCAN": "", 
  "SERVER_ALLOW_MANUAL_SCAN": false, 
  "SERVER_FILE_CHECK_DELAY": 60, 
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {
  }, 
  "SERVER_IGNORE_LIST": [
    "/.grab/", 
    ".DS_Store", 
    "Thumbs.db"
  ], 
  "SERVER_IP": "0.0.0.0", 
  "SERVER_MAX_FILE_CHECKS": 10, 
  "SERVER_PASS": "NONONO", 
  "SERVER_PATH_MAPPINGS": {
  }, 
  "SERVER_PORT": 3467, 
  "SERVER_SCAN_DELAY": 180, 
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false, 
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/nhk_shows/"
    ], 
    "1": [
      "/TV/"
    ], 
    "2": [
      "/Movies/"
    ]
  }, 
  "SERVER_USE_SQLITE": false, 
  "USE_DOCKER": false, 
  "USE_SUDO": true
}

Potential to integrate with rclone mounts

Since rclone now has the ability to locally purge some of the cache on a remote mount, if you're using google drive for example to host your media, it may be helpful to those who have a seedbox and a cloud plex VPS.

In my own use case I have a seedbox and a plex vps, and I have a 10 min wait time for plex_autoscan to attempt to find the files but it doesn't always purge the cache in time so plex_autoscan eventually gives up and the files aren't added to plex.

https://github.com/ncw/rclone/blob/master/docs/content/rc.md

gdrive teamdrive monitoring issues on shared teamdrive

Seems like so far no one tested this in CentOS7. I was able to install this on CentOS7 and start it up Successfully.
I couldn't get my gdrive teamdrive monitoring going. Not sure if its a config issue or something else.
Running in DEBUG mode doesn't give me any errors.

Multiple Remote paths

Trying to get multiple remote paths remapped. But not having luck. What is the proper way to accomplish this?

  "SERVER_PATH_MAPPINGS": {
    "/mnt/unionfs/": [
      "/mnt/shared/Application Data/fusemounts/unionfs/"
     ],
      "/mnt/unionfs/": [
      "/mnt/shared/unionfs/"
   ]
  },

Description Metadata?

I used plex autoscan for a test run on a few episodes. For the few episodes I tried it on the description and episode title have never loaded and I can not get it to load.

Is this expected behavior?

Unable to map to section id

Hello,
First of all I would like to say thank you for this awesome pease of software! :)

I'm heaving an issue running this via sonarr:

2018-01-23 14:47:44,306 -     INFO -  AUTOSCAN [31326]: Client 'xxx' scan request for series: '/sonarr/path.mkv', event: 'Download'
 2018-01-23 14:47:44,306 -    ERROR -     UTILS [31326]: Unable to map '/plex/path.mkv' to a section id....

The file that needs to be mapped exists on the mounted folder.
In the config.json I have

    "PLEX_SECTION_PATH_MAPPINGS": {
        "5": [
            "/Movies/"
        ],
	"3": [
            "/TV Shows/"
        ]
    },
~# python scan.py sections
  3: TV Shows
  5: Movies

Is there anything that I'm doing wrong here?

Thanks!

Edit1: My bad, the /TV Shows/ is not the plex category is the driver folder, solved :)

Internal Server Error

When submitting the following path to the manual scan webpage, I get a Internal Server Error

/mnt/TVShows/Superstore/Season 4/Superstore - S04E17 - Quinceañera [WEBDL-1080p][EAC3 5.1][h264][NTb].mkv

The exact error is

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Forgot to add, it actually added the path to the scan log. It just displayed the error for the webpage.

Unable to get Plex Section IDs

I have the newest plex 1.15.0.659 which moved there lib dir and i made the change in my config to reflect but I am unable to get section IDs when running the python command. This is all i get. I don't know how to diagnose this further. I was following the install instructions and I am stuck at this part of the install.

 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using ENV setting PLEX_AUTOSCAN_LOGLEVEL=DEBUG
 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using default setting --cachefile=cache.db
 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using default setting --tokenfile=token.json
 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using ENV setting PLEX_AUTOSCAN_QUEUEFILE=/config/plex_autoscan/queue.db
 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using ENV setting PLEX_AUTOSCAN_LOGFILE=/config/plex_autoscan/plex_autoscan.log
 2019-02-08 18:01:43,020 -     INFO -    CONFIG [139874172593984]: Using ENV setting PLEX_AUTOSCAN_CONFIG=/config/plex_autoscan/config.json
 2019-02-08 18:01:43,021 -     INFO -    CONFIG [139874172593984]: Using ENV setting USE_DOCKER=False
 2019-02-08 18:01:43,021 -     INFO -    CONFIG [139874172593984]: Using ENV setting USE_SUDO=False
 2019-02-08 18:01:43,198 -     INFO -  AUTOSCAN [139874172593984]: 
        _                         _                            
  _ __ | | _____  __   __ _ _   _| |_ ___  ___  ___ __ _ _ __  
 | '_ \| |/ _ \ \/ /  / _` | | | | __/ _ \/ __|/ __/ _` | '_ \ 
 | |_) | |  __/>  <  | (_| | |_| | || (_) \__ \ (_| (_| | | | |
 | .__/|_|\___/_/\_\  \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
 |_|                                                           
 
#########################################################################
# Author:   l3uddz                                                      #
# URL:      https://github.com/l3uddz/plex_autoscan                     #
# --                                                                    #
# Part of the Cloudbox project: https://cloudbox.works                  #
#########################################################################
# GNU General Public License v3.0                                       #
#########################################################################

 2019-02-08 18:01:43,198 -     INFO -      PLEX [139874172593984]: Using Plex Scanner
 2019-02-08 18:01:43,198 -    DEBUG -      PLEX [139874172593984]: export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib;export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application\ Support;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --list

file not found

hi, i hope you can help me.

plex_autoscan just won't find the files imported with sonarr.

i am using sonarr in a docker container and plex in a docker container and i think there is something that i am missing.

plex mountpoint for shows: /plexdrive/tvshows
sonarr mountpoint /tvshows
place on server /mnt/data/plexdrive/tvshows

this is my section path mappings:

"PLEX_SECTION_PATH_MAPPINGS": {
    "13": [
      "/tvshows/"
    ]
  },

and this is my server path mapping:

"SERVER_PATH_MAPPINGS": {
     "/plexdrive/": [
       "/mnt/data/plexdrive/"
     ],

i tried a couple of different variations and this seems to work in a way, but when i add a show i get this

 2018-04-23 15:58:23,718 -     INFO -  AUTOSCAN [140691682518784]: Client '172.25.0.9' scan request for series: '/tvshows/SHOW/Season 3/EPISODE', event: 'Download'
 2018-04-23 15:58:23,719 -     INFO -      PLEX [140691600738048]: Scan request from Sonarr for '/tvshows/SHOW/Season 3/EPISODE', sleeping for 5 seconds...
 2018-04-23 15:58:28,725 -     INFO -      PLEX [140691600738048]: File '/plexdrive/tvshowsshows/SHOW/Season 3/EPISODE' did not exist on check 1 of 10, checking again in 60 seconds.

plex_autoscan seems to think that the path is /plexdrive/tvshowsshows. where does the second "show" come from?

thanks for your help
config.json

Feature: add variable for duration between file checks

First of all: Great little tool!! I only discovered it a couple of days ago and already love it!

There's only one small problem I have with it. I have two different servers, one for uploading to my drive, and one for PMS. So PMS only sees the files once actually uploaded to the drive, which is, in case of very large files, substantially later than after Sonarr/Radarr calls the webhook. I increased the SERVER_SCAN_DELAY to 1 hour, but even that is not enough for large files. What I would like to see is an option SERVER_FILE_CHECK_DELAY, which is applied as a delay between the file checks, instead of the one minute default. That way, I could decrease my SERVER_SCAN_DELAY to something like 15 minutes, which is perfect for TV episodes, and in case of a 4K movie, the much increased SERVER_FILE_CHECK_DELAY would check the drive until it finally appears.

I hope that this is not too hard to implement! Keep up the great work!!

SERVER_USE_SQLITE WIKI/Explenation

Hi,

Could you explain the purpose of the "SERVER_USE_SQLITE" option? I've been using this script on Windows so my Plex VM will issue a scan on a specific folder after import... because media is on my Hypervisor & downloads come from another VM.

However... I'm trying to speed up the scan process and was wondering what the SERVER_USE_SQLITE option does.

Autoscan Logs - Ignored 1 file(s) from Google Drive changes....

Hi guys

For some reason, when I tail the plex autoscan logs, I get this appearing all the time:

2018-10-31 14:32:15,316 - INFO - AUTOSCAN [139806662977280]: There's 1 Google Drive change(s) to process 2018-10-31 14:32:15,337 - INFO - AUTOSCAN [139806662977280]: Ignored 1 file(s) from Google Drive changes for already being in Plex!

Any idea how to go about finding what is 'sticking' in there?

Could not locate record in media_parts

I've been having this error a lot with trying to use this script with Sonarr/Radarr. I'm not sure what is not working.
I get the following error below and have tried to adjust my config to fix it but have had no luck

My config is

{
  "DOCKER_NAME": "user", 
  "PLEX_ANALYZE_DIRECTORY": true, 
  "PLEX_ANALYZE_TYPE": "basic", 
  "PLEX_DATABASE_PATH": "/folder/to/user/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db", 
  "PLEX_EMPTY_TRASH": true, 
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    "/folder/user/gmedia/mountcheck"
  ], 
  "PLEX_EMPTY_TRASH_MAX_FILES": 100, 
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false, 
  "PLEX_LD_LIBRARY_PATH": "/folder/to/user/Library/Plex/current/usr/lib/plexmediaserver", 
  "PLEX_LOCAL_URL": "http://localhost:38192", 
  "PLEX_SCANNER": "/folder/user/user/Library/Plex/current/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner", 
  "PLEX_SECTION_PATH_MAPPINGS": {
    "1": [
      "/Movies/"
    ], 
    "2": [
      "/TV/"
    ]
  }, 
  "PLEX_SUPPORT_DIR": "/folder/to/user/Library/Application\\ Support", 
  "PLEX_TOKEN": "oo23m3om3o3mrotfj", 
  "PLEX_USER": "user", 
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true, 
  "RCLONE_RC_CACHE_EXPIRE": {
    "ENABLED": true, 
    "MOUNT_FOLDER": "/folder/user/gmedia", 
    "RC_URL": "http://user:k29r9v9k92k3e9fir9jgj9rj93@localhost:12341"
  }, 
  "RUN_COMMAND_BEFORE_SCAN": "", 
  "SERVER_ALLOW_MANUAL_SCAN": false, 
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {}, 
  "SERVER_IGNORE_LIST": [
    "/.grab/", 
    ".DS_Store", 
    "Thumbs.db"
  ], 
  "SERVER_IP": "127.0.0.1", 
  "SERVER_MAX_FILE_CHECKS": 10, 
  "SERVER_PASS": "zyUX3ygQHAanrZQChPQAJQz5wLT850UwkE5BbnhWXIt52Agjc87Mr3RNvjIKGtNO", 
  "SERVER_PATH_MAPPINGS": {}, 
  "SERVER_PORT": 12345, 
  "SERVER_SCAN_DELAY": 5, 
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/TV/"
    ], 
    "1": [
      "/Movies/"
    ]
  }, 
  "SERVER_USE_SQLITE": true, 
  "USE_DOCKER": false, 
  "USE_SUDO": false
}

And the server log

2018-06-04 16:29:14,591 -     INFO -  AUTOSCAN [id2]: Starting queue processor in 10 seconds
 2018-06-04 16:29:14,591 -     INFO -  AUTOSCAN [id]: Starting server:
 2018-06-04 16:29:24,599 -     INFO -  AUTOSCAN [id2]: Queue processor started
 2018-06-04 16:29:24,600 -     INFO -  AUTOSCAN [id2]: Restored 0 scan requests from database
"/home/user/folder/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db" 2018-06-04 16:30:34,725 -    DEBUG -  AUTOSCAN [id]: Client '127.0.0.1' request dump:
{
    "episodeFile": {
        "id": 11111, 
        "path": "/home/ms/files/deluge/Show.2015.S02.1080p.NF.WEB-DL.DD5.1.x264-PAs/Show.2015.S02E03.1080p.NF.WEB-DL.DD5.1.x264-PAs.mkv", 
        "quality": "WEBDL-1080p", 
        "qualityVersion": 1, 
        "relativePath": "Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv", 
        "releaseGroup": "PAs", 
        "sceneName": "Show.2015.S02E03.1080p.NF.WEB-DL.DD5.1.x264-PAs"
    }, 
    "episodes": [
        {
            "airDate": "2017-01-01", 
            "airDateUtc": "2017-01-01T00:00:00Z", 
            "episodeNumber": 3, 
            "id": 11111, 
            "quality": "WEBDL-1080p", 
            "qualityVersion": 1, 
            "releaseGroup": "PAs", 
            "sceneName": "Show.2015.S02E03.1080p.NF.WEB-DL.DD5.1.x264-PAs", 
            "seasonNumber": 2, 
            "title": "The Title Name"
        }
    ], 
    "eventType": "Download", 
    "isUpgrade": false, 
    "series": {
        "id": 111, 
        "path": "/folder/user/gmedia/TV/Show (2015)", 
        "title": "Show (2015)", 
        "tvdbId": 111111
    }
}
 2018-06-04 16:30:34,725 -     INFO -  AUTOSCAN [id]: Client '127.0.0.1' scan request for series: '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', event: 'Download'
 2018-06-04 16:30:34,725 -    DEBUG -  AUTOSCAN [id]: Using section id: 2 for '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv'
 2018-06-04 16:30:34,761 -     INFO -  AUTOSCAN [id]: Added '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv' to database, proceeding with scan
 2018-06-04 16:30:34,763 -     INFO -      PLEX [id2]: Scan request from Sonarr for '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', sleeping for 5 seconds...
 2018-06-04 16:30:39,766 -     INFO -      PLEX [id2]: File '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv' exists on check 1 of 10.
 2018-06-04 16:30:39,766 -    DEBUG -     UTILS [id2]: Using priority 0 for path '/folder/user/gmedia/TV/Show (2015)/Season 2'
 2018-06-04 16:30:39,767 -    DEBUG -      PLEX [id2]: Waiting for turn in the scan request backlog with priority: 0
 2018-06-04 16:30:39,767 -     INFO -      PLEX [id2]: Scan request is now being processed
 2018-06-04 16:30:39,787 -     INFO -      PLEX [id2]: No 'Plex Media Scanner' processes were found.
 2018-06-04 16:30:39,787 -     INFO -      PLEX [id2]: Starting Plex Scanner
 2018-06-04 16:30:39,787 -    DEBUG -      PLEX [id2]: export LD_LIBRARY_PATH=/home/user/folder/Library/Plex/current/usr/lib/plexmediaserver;export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/user/folder/Library/Application\ Support;/home/user/folder/Library/Plex/current/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 2 --directory '/folder/user/gmedia/TV/Show (2015)/Season 2'
 2018-06-04 16:30:40,335 -     INFO -     UTILS [id2]: GUI: Scanning Show Season 2 Episode 1
 2018-06-04 16:30:40,337 -     INFO -     UTILS [id2]: GUI: Scanning Show Season 2 Episode 2
 2018-06-04 16:30:40,342 -     INFO -     UTILS [id2]: GUI: Scanning Show Season 2 Episode 3
 2018-06-04 16:30:40,645 -     INFO -      PLEX [id2]: Finished scan!
 2018-06-04 16:30:40,667 -     INFO -      PLEX [id2]: Removed '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv' from database
 2018-06-04 16:30:41,668 -     INFO -      PLEX [id2]: There is 0 queued items remaining...
 2018-06-04 16:30:41,668 -     INFO -      PLEX [id2]: Checking deleted item count in 10 seconds...
 2018-06-04 16:30:51,684 -     INFO -      PLEX [id2]: Skipping emptying trash as there were no deleted items
 2018-06-04 16:30:51,684 -    DEBUG -      PLEX [id2]: Sleeping 10 seconds before sending analyze request
 2018-06-04 16:31:01,698 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', 1/5 attempts...
 2018-06-04 16:31:11,701 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', 2/5 attempts...
 2018-06-04 16:31:21,706 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', 3/5 attempts...
 2018-06-04 16:31:31,717 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', 4/5 attempts...
 2018-06-04 16:31:41,727 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv', 5/5 attempts...
 2018-06-04 16:31:51,730 -    ERROR -      PLEX [id2]: Could not locate record in media_parts where file = '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv' after 5 tries...
 2018-06-04 16:31:51,731 -     INFO -      PLEX [id2]: Aborting analyze of '/folder/user/gmedia/TV/Show (2015)/Season 2/Show (2015) - S02E03 - WEBDL-1080p PAs.mkv' because could not find any metadata_item_id for it

Google Drive Path Issue

As a foreign user, I'm not sure if my GD paths begin with "My Drive/". I tried both adding the path beginning with "My Drive/" in the config and just leaving it blank between the "", but when I uploaded something to my GD, nothing changed to the log, which have been always

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!

since the start.
Would anyone please provide some more specific instructions to this? Thanks in advance!

Unicode Encode Error

I keep getting this error when its scanning. Items still appear, but I get this error.

Jan 26 17:11:29 s131265 scan.py[7564]:   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
Jan 26 17:11:29 s131265 scan.py[7564]:     self.run()
Jan 26 17:11:29 s131265 scan.py[7564]:   File "/usr/lib/python2.7/threading.py", line 754, in run
Jan 26 17:11:29 s131265 scan.py[7564]:     self.__target(*self.__args, **self.__kwargs)
Jan 26 17:11:29 s131265 scan.py[7564]:   File "/opt/plex_autoscan/plex.py", line 61, in scan
Jan 26 17:11:29 s131265 scan.py[7564]:     scan_path_is_directory = os.path.isdir(check_path)
Jan 26 17:11:29 s131265 scan.py[7564]:   File "/usr/lib/python2.7/genericpath.py", line 49, in isdir
Jan 26 17:11:29 s131265 scan.py[7564]:     st = os.stat(s)
Jan 26 17:11:29 s131265 scan.py[7564]: UnicodeEncodeError: 'latin-1' codec can't encode character u'\u2019' in position 102: ordinal not in range(256)

it doesnt crash the script.

Could someone please help me in setup?

Hello, good morning everyone! Sorry for my English.
I would like to ask for help in configuring plex_autoscan for my server, I tried several times, but I did not get success. Next: I do not have radar and the like, only the rclone in the following order of assembly.

DRIVE> CACHE> CRYPT

Mounting on:
/ home / plexuser / mnt / Gdrive

Structure of the complete paths sections

/home/plexuser/mnt/Gdrive/Midia/Movies
/home/plexuser/mt/Gdrive/Midia/TV Shows
/home/plexuser/mnt/Gdrive/3D/Movies

scan.py sections displays:

plexuser@plex:/opt/plex_autoscan$ ./scan.py sections
 2018-10-19 07:00:23,085 -     INFO -    CONFIG [139761047496448]: Using default setting --loglevel=INFO
 2018-10-19 07:00:23,087 -     INFO -    CONFIG [139761047496448]: Using default setting --cachefile=./cache.db
 2018-10-19 07:00:23,087 -     INFO -    CONFIG [139761047496448]: Using default setting --tokenfile=./token.json
 2018-10-19 07:00:23,088 -     INFO -    CONFIG [139761047496448]: Using default setting --queuefile=./queue.db
 2018-10-19 07:00:23,088 -     INFO -    CONFIG [139761047496448]: Using default setting --logfile=./plex_autoscan.log
 2018-10-19 07:00:23,089 -     INFO -    CONFIG [139761047496448]: Using default setting --config=./config/config.json
 2018-10-19 07:00:23,974 -     INFO -  AUTOSCAN [139761047496448]:
        _                         _
  _ __ | | _____  __   __ _ _   _| |_ ___  ___  ___ __ _ _ __
 | '_ \| |/ _ \ \/ /  / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
 | |_) | |  __/>  <  | (_| | |_| | || (_) \__ \ (_| (_| | | | |
 | .__/|_|\___/_/\_\  \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
 |_|

#########################################################################
# Author:   l3uddz                                                      #
# URL:      https://github.com/l3uddz/plex_autoscan                     #
# --                                                                    #
# Part of the Cloudbox project: https://cloudbox.rocks                  #
#########################################################################
# GNU General Public License v3.0                                       #
#########################################################################

 2018-10-19 07:00:23,998 -     INFO -      PLEX [139761047496448]: Using Plex Scanner
  2: Filmes
  6: Filmes 3D
  1: Séries de TV

my config.json configuration file

plexuser@plex:/opt/plex_autoscan/config$ sudo cat config.json
{
  "DOCKER_NAME": "plex",
  "GDRIVE": {
    "CLIENT_ID": "",
    "CLIENT_SECRET": "",
    "ENABLED": false,
    "POLL_INTERVAL": 60,
    "SCAN_EXTENSIONS": [
      "webm",
    ]
  },
  "PLEX_ANALYZE_DIRECTORY": true,
  "PLEX_ANALYZE_TYPE": "basic",
  "PLEX_DATABASE_PATH": "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db",
  "PLEX_EMPTY_TRASH": false,
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    "/mnt/unionfs/mounted.bin"
  ],
  "PLEX_EMPTY_TRASH_MAX_FILES": 100,
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false,
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver",
  "PLEX_LOCAL_URL": "http://localhost:32400",
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
  "PLEX_SECTION_PATH_MAPPINGS": {
    "1": [
      "/home/plexuser/mnt/Gdrive/Midia/TV\\ Shows/"
    ],
    "2": [
      "/home/plexuser/mnt/Gdrive/Midia/Movies/"
    ],
    "6": [
      "home/plexuser/mnt/Gdrive/3D/Movies/"
    ]
  },
  "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support",
  "PLEX_TOKEN": "EXVfpPsasasdDsYs9znzG",
  "PLEX_USER": "plex",
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true,
  "RCLONE_RC_CACHE_EXPIRE": {
    "ENABLED": true,
    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
      "Media/": [
        "/home/plexuser/mnt/Gdrive/Midia"
      ]
    },
    "RC_URL": "http://localhost:5572"
  },
  "RUN_COMMAND_BEFORE_SCAN": "",
  "SERVER_ALLOW_MANUAL_SCAN": false,
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {
    "/home/thompsons/plexdrive": [
      "/data"
    ]
  },
  "SERVER_IGNORE_LIST": [
    "/.grab/",
    ".DS_Store",
    "Thumbs.db"
  ],
  "SERVER_IP": "0.0.0.0",
  "SERVER_MAX_FILE_CHECKS": 10,
  "SERVER_PASS": "d980da57bd8e49e496b35bf623ee9f2d",
  "SERVER_PATH_MAPPINGS": {
    "/mnt/unionfs": [
      "/home/seed/media/fused"
    ]
  },
  "SERVER_PORT": 3467,
  "SERVER_SCAN_DELAY": 180,
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false,
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/Movies/"
    ],
    "1": [
      "/TV/"
    ],
    "2": [
      "/Music/"
    ]
  },
  "SERVER_USE_SQLITE": true,
  "USE_DOCKER": false,
  "USE_SUDO": true
}

Rclone drive being mounted with the following options:

plexuser@plex:/opt/plex_autoscan/config$ sudo cat /etc/systemd/system/rclone.service
[Unit]
Description=Mount and cache Google drive to /home/plexuser/mnt/Gdrive
After=syslog.target local-fs.target network.target
[Service]
Environment=RCLONEHOME=/home/plexuser/.config/rclone
Environment=MOUNTTO=/home/plexuser/mnt/Gdrive
Type=simple
User=root
ExecStartPre=/bin/mkdir -p ${MOUNTTO}
ExecStart=/usr/bin/rclone mount \
  --rc \
  --log-file /home/plexuser/logs/rclone.log \
  --log-level INFO \
  --fuse-flag sync_read \
  --umask 022 \
  --allow-non-empty \
  --allow-other \
  --tpslimit 10 \
  --tpslimit-burst 10 \
  --dir-cache-time=48h \
  --buffer-size=32M \
  --attr-timeout=1s \
  --vfs-read-chunk-size=2M \
  --vfs-read-chunk-size-limit=2G \
  --vfs-cache-max-age=5m \
  --vfs-cache-mode=writes \
  --cache-tmp-wait-time=5m
  --config ${RCLONEHOME}/rclone.conf \
  GdriveC: ${MOUNTTO}
ExecStop=/bin/fusermount -u -z ${MOUNTTO}
ExecStop=/bin/rmdir ${MOUNTTO}
Restart=always
[Install]
WantedBy=multi-user.target

I would like help if possible, I have tried everything, but I did not succeed in scanning the library after the cache expired. I do not know if this is the right place to ask for this kind of help, if it is not, I apologize.

Plex_autoscan block after a second request

First of all, I thank you for making your work available. I expose you my problem. (Sorry from my poor english, i'm french)

I created a docker image with rclone plexdrive5 unionfs plex_autoscan that I modified in my dockerfile to work with python3
https://github.com/laster13/plexdrive-rclone

sed -i -e "s/import Queue/import queue/g" threads.py && \
sed -i -e "s/self._waiter_queue = Queue.PriorityQueue()/self._waiter_queue = queue.PriorityQueue()/g" threads.py && \
sed -i -e "s/from urllib import urlencode/from urllib.parse import urlencode/g" gdrive.py && \

Sonarr sends his scan request to plex_autoscan it works.

2018-08-19 18:28:56,292 -     INFO -  AUTOSCAN [112975860950784]: Client '127.0.0.1' scan request for series: '/tv/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi', event: 'Download'
 2018-08-19 18:28:56,292 -    DEBUG -     UTILS [112975860950784]: Mapping '/tv/' to '/mnt/Union/TV/'
 2018-08-19 18:28:56,292 -    DEBUG -  AUTOSCAN [112975860950784]: Using section id: 1 for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi'
 2018-08-19 18:28:56,296 -     INFO -      PLEX [112975774209792]: Scan request from Sonarr for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi', sleeping for 1 seconds...
 2018-08-19 18:28:57,298 -     INFO -      PLEX [112975774209792]: File '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi' exists on check 1 of 10.
 2018-08-19 18:28:57,298 -    DEBUG -     UTILS [112975774209792]: Using priority 0 for path '/mnt/Union/TV/Ballers/Season 3'
 2018-08-19 18:28:57,298 -    DEBUG -      PLEX [112975774209792]: Waiting for turn in the scan request backlog with priority: 0
 2018-08-19 18:28:57,299 -     INFO -      PLEX [112975774209792]: Scan request is now being processed
 2018-08-19 18:28:57,301 -     INFO -      PLEX [112975774209792]: No 'Plex Media Scanner' processes were found.
 2018-08-19 18:28:57,301 -     INFO -      PLEX [112975774209792]: Starting Plex Scanner
 2018-08-19 18:28:57,302 -    DEBUG -      PLEX [112975774209792]: export LD_LIBRARY_PATH=/usr/lib/plexmediaserver;export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/config/Library/Application\ Support;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --refresh --section 1 --directory '/mnt/Union/TV/Ballers/Season 3'
 2018-08-19 18:28:57,632 -     INFO -     UTILS [112975774209792]: 'GUI: Scanning Ballers Season 3 Episode 1'
 2018-08-19 18:28:57,633 -     INFO -     UTILS [112975774209792]: 'GUI: Scanning Ballers Season 3 Episode 2'
 2018-08-19 18:28:57,788 -     INFO -     UTILS [112975774209792]: "GUI: Requesting metadata for 'Ballers'"
 2018-08-19 18:28:57,851 -     INFO -     UTILS [112975774209792]: 'GUI: Background media analysis on Ballers S03 E02'
 2018-08-19 18:28:58,124 -     INFO -      PLEX [112975774209792]: Finished scan!
 2018-08-19 18:28:58,124 -    DEBUG -      PLEX [112975774209792]: Sleeping 10 seconds before sending analyze request
 2018-08-19 18:29:08,139 -     INFO -      PLEX [112975774209792]: Found row in media_parts where file = '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi' after 1/5 tries!
 2018-08-19 18:29:08,140 -    DEBUG -      PLEX [112975774209792]: Found metadata_item_id for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi': 16
 2018-08-19 18:29:08,140 -    DEBUG -      PLEX [112975774209792]: Found parent_id for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E02 - Bull Rush SDTV.avi': 13
 2018-08-19 18:29:08,141 -     INFO -      PLEX [112975774209792]: Starting basic analysis of metadata_item(s): 13
 2018-08-19 18:29:08,141 -    DEBUG -      PLEX [112975774209792]: export LD_LIBRARY_PATH=/usr/lib/plexmediaserver;export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/config/Library/Application\ Support;/usr/lib/plexmediaserver/Plex\ Media\ Scanner --analyze --item 13
 2018-08-19 18:29:08,409 -     INFO -     UTILS [112975774209792]: 'GUI: Media analysis on Ballers S03 E01'
 2018-08-19 18:29:10,821 -     INFO -     UTILS [112975774209792]: 'GUI: Media analysis on Ballers S03 E02'
 2018-08-19 18:29:10,933 -     INFO -      PLEX [112975774209792]: Finished basic analysis of metadata_item(s): 13!

On the other hand, if he sends a second request, it blocks at this level

 2018-08-19 18:31:26,558 -     INFO -  AUTOSCAN [112975860950784]: Client '127.0.0.1' scan request for series: '/tv/Ballers/Season 3/Ballers - S03E03 - In the Teeth SDTV.avi', event: 'Download'
 2018-08-19 18:31:26,558 -    DEBUG -     UTILS [112975860950784]: Mapping '/tv/' to '/mnt/Union/TV/'
 2018-08-19 18:31:26,558 -    DEBUG -  AUTOSCAN [112975860950784]: Using section id: 1 for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E03 - In the Teeth SDTV.avi'
 2018-08-19 18:31:26,559 -     INFO -      PLEX [112975774209792]: Scan request from Sonarr for '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E03 - In the Teeth SDTV.avi', sleeping for 1 seconds...
 2018-08-19 18:31:27,560 -     INFO -      PLEX [112975774209792]: File '/mnt/Union/TV/Ballers/Season 3/Ballers - S03E03 - In the Teeth SDTV.avi' exists on check 1 of 10.
 2018-08-19 18:31:27,561 -    DEBUG -     UTILS [112975774209792]: Using priority 0 for path '/mnt/Union/TV/Ballers/Season 3'
 2018-08-19 18:31:27,561 -    DEBUG -      PLEX [112975774209792]: Waiting for turn in the scan request backlog with priority: 0
Connection to 82.94.168.53 closed by remote host.

my docker-compose

version: '2.1'
services:
  sonarr:
    container_name: sonarr
    image: linuxserver/sonarr
    restart: unless-stopped
    ports:
      - 8989:8989
    depends_on:
      - torrent
    depends_on:
        plex:
           condition: service_healthy
    environment:
      - /etc/localtime:/etc/localtime:ro \
      - TZ=Paris/Europe
      - PUID=0
      - PGID=0
    volumes:
      - /mnt/docker/sonarr/config:/config
      - /mnt/docker/rutorrent/data/torrents:/downloads
      - /mnt/docker/Plex/Union/TV:/tv

  plex:
    container_name: plex
    image: laster13/plexdrive-rclone
    restart: unless-stopped
    ports:
      - 32400:32400
    healthcheck:
        interval: 10s
        timeout: 1s
    cap_add:
      - SYS_ADMIN
      - MKNOD
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    environment:
      - TZ=Paris/Europe
      - PLEX_CLAIM=
      - PLEX_UID=0
      - PLEX_GID=0
    hostname: mail
    volumes:
      - /mnt/docker/Plex/config:/config
      - /dev/shm:/transcode
      - /mnt/docker/Plex/Union:/mnt/Union:shared
      - /mnt/docker/Plex/Pre:/mnt/Pre:shared
      - /mnt/docker/Plex/rclone:/mnt/rclone:shared

  torrent:
    container_name: torrent
    image: xataz/rtorrent-rutorrent
    restart: unless-stopped
    ports:
      - 9080:8080
      - 6881:6881
      - 6881:6881/udp
      - 127.0.0.1:5000:5000
    environment:
      - UID=1001
      - GID=1001
      - WEBROOT=/rutorrent
      - DHT_RTORRENT=on
      - PORT_RTORRENT=6881
    volumes:
      - /mnt/docker/rutorrent/data:/data
      - /mnt/docker/rutorrent/config:/config

if I restart the container it works again

my config.json

  "PLEX_ANALYZE_DIRECTORY": true,
  "PLEX_ANALYZE_TYPE": "basic",
  "PLEX_DATABASE_PATH": "/config/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db",
  "PLEX_EMPTY_TRASH": false,
  "PLEX_EMPTY_TRASH_CONTROL_FILES": [
    "/mnt/Union/mounted.bin"
  ],
  "PLEX_EMPTY_TRASH_MAX_FILES": 100,
  "PLEX_EMPTY_TRASH_ZERO_DELETED": false,
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver",
  "PLEX_LOCAL_URL": "http://localhost:32400",
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
  "PLEX_SECTION_PATH_MAPPINGS": {
    "1": [
      "/TV/"
    ]
  },
  "PLEX_SUPPORT_DIR": "/config/Library/Application\\ Support",
  "PLEX_TOKEN": "xHp7Y92i3Rbiz361GPJR",
  "PLEX_USER": "plex",
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true,
  "RCLONE_RC_CACHE_EXPIRE": {
    "ENABLED": false,
    "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
    },
    "RC_URL": "http://localhost:5572"
  },
  "RUN_COMMAND_BEFORE_SCAN": "",
  "SERVER_ALLOW_MANUAL_SCAN": true,
  "SERVER_FILE_EXIST_PATH_MAPPINGS": {},
  "SERVER_IGNORE_LIST": [
    "/.grab/",
    ".DS_Store",
    "Thumbs.db"
  ],
  "SERVER_IP": "127.0.0.1",
  "SERVER_MAX_FILE_CHECKS": 10,
  "SERVER_PASS": "19b21980d2dd4fc8a2931dc8e6f8f073",
  "SERVER_PATH_MAPPINGS": {
    "/mnt/Union/TV/": [
      "/tv/"
    ]
  },
  "SERVER_PORT": 3467,
  "SERVER_SCAN_DELAY": 1,
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": true,
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/TV/"
    ]
  },
  "SERVER_USE_SQLITE": false,
  "USE_DOCKER": false,
  "USE_SUDO": true
}

my structure

Docker Data
├── pms-docker
│   ├── config
│   │   ├── Library
|   |   |   └── ...
│   │   │
│   │   ├── .plexdrive
│   │   |   └── ...
|   |   | 
|   |   ├── rclone
|   |   |   └── ...
|   |   |
|   |   ├── plex_autoscan
|   |   |   └── ...
|   |   |
|   |   ├── unionfs_cleaner
|   |   |   └── ...
|   |   |
|   |   ├── plex_dupefinder
|   |       └── ...
|   |   
│   └── transcode
└──

If you can help me, it's been a week that I search without success, I'm at the end of ideas

Thanks

Not matching section id

I'm feeling really stupid as I can't figure out what I'm missing here as these are my section IDs.

 2018-07-18 16:00:39,209 -     INFO -      PLEX [140300953007936]: Using Plex Scanner
  1: Movies
  2: TV Shows

and I have my config with the file paths below as I have 2 paths per each library section:

  "PLEX_SECTION_PATH_MAPPINGS": {
    "1": [
      "/gmedia/Radarr_Movies/"
    ],
    "1": [
      "/gmedia/Movies/"
    ],
    "2": [
      "/gmedia/TV/"
    ],
    "2": [
      "/gmedia/TV_Ended/"
    ]
  },

Yet, I'm not matching:

 2018-07-18 15:36:01,504 -     INFO -  AUTOSCAN [140206010705728]: Starting server: http://0.0.0.0:3467/autoscanpassword
 2018-07-18 15:50:53,600 -     INFO -  AUTOSCAN [140206010705728]: Client '127.0.0.1' scan request for movie: '/gmedia/Radarr_Movies/Ocean's Twelve (2004)/Ocean's Twelve (2
004).mkv', event: 'Download'
 2018-07-18 15:50:53,602 -    ERROR -     UTILS [140206010705728]: Unable to map '/gmedia/Radarr_Movies/Ocean's Twelve (2004)/Ocean's Twelve (2004).mkv' to a section id....
 2018-07-18 16:00:39,209 -     INFO -  AUTOSCAN [140300953007936]:

What is my silly mistake?

Google Drive Monitor Only Specific Folders

Rather than having google drive ignore certain file paths, is there a way to tell it to monitor only a certain folder path rather than the whole drive? I use my drive for many other things than Plex and it is causing this utility to crash rather frequently from files unrelated to its purpose.

No episode artwork

With my plex_autoscan, it currently doesn't get any episode image. If it does, it's usually the season artwork instead of episode artwork. It's scraping metadata just fine, but I'm just not getting the image.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.