Newly downloaded media from Sonarr and Radarr are not being added to Plex?¶
Test another download and run the following command:
tail-f/opt/plex_autoscan/plex_autoscan.log
If you see this...
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
boost::filesystem::create_directories: Permission denied: "/config/Library/Logs"
There is an issue with the permissions on that folder that you'll need to fix manually (Saltbox can't fix this as Plex creates this folder after the first scan)
To fix this, Run the following command. Replace user and group to match yours (see here).
2017-11-21 04:26:32,619 - ERROR - PLEX [ 7089]: Exception finding metadata_item_id for '/data/TV/Gotham/Season 01/Gotham - S01E01 - Pilot.mkv':
2017-11-21 04:26:32,619 - INFO - PLEX [ 7089]: Aborting analyze of '/data/TV/Gotham/Season 01/Gotham - S01E01 - Pilot.mkv' because could not find a metadata_item_id for it
Possible Issues:
One of the mounts has changed (e.g. Rclone_VFS or MergerFS was restarted).
Permission issues (see [here]).
Solution 1:
Make sure the remote mount is working OK (pick the relevant one below).
The current default used for mounting cloud storage is Rclone VFS:
sudosystemctlstatusrclone_vfs
Make sure the union mount is working OK.
The current default used for creating the union mount is MergerFS:
Every time Sonarr or Radarr downloads a new file, or upgrades a previous one, a request is sent to Plex via Plex Autoscan to scan the movie folder or TV season path and look for changes. Since Sonarr and Radarr delete previous files on upgrades, the scan will cause the new media to show up in your Plex Library, however, the deleted files would be missing, and instead, marked as "unavailable" (i.e. trash icon). When the control file is present and the option in the Plex Autoscan config is enabled (default), Plex Autoscan will empty the trash for you, thereby, removing the deleted media from the library.
If the remote mount for you cloud storage provider (e.g. Google Drive) ever disconnected during a Plex scan of your media, Plex would mark the missing files as unavailable and emptying the trash would cause them to be removed out of the library. To avoid this from happening, Plex Autoscan checks for a control file in the unionfs path (i.e. /mnt/unionfs/mounted.bin) before running any empty trash commands. The control file is just a blank file that resides on the root folder of your Rclone remote (i.e. cloud storage provider) and let's Plex Autoscan know that it is still mounted.
Once the remote is remounted, all the files marked unavailable in Plex will be playable again and Plex Autoscan will resume its emptying trash duties post-scan.
Why is SERVER_SCAN_DELAY set to 180 seconds by default?¶
When Plex Autoscan gets a scan request from Sonarr, it tells Plex to scan the relevant TV Show season folder. So to avoid multiple Plex scans of the same season when more episodes of that same season come in, Plex Autoscan can wait (ala SERVER_SCAN_DELAY) and merge multiple scan requests into a single one. This is particularly noticeable when consecutive episodes are being downloaded/imported into Sonarr.
During this SERVER_SCAN_DELAY, if another request comes in for the same season folder, it will restart the delay timer again, thus allowing for even more time for new items to come in.
SERVER_SCAN_DELAY of 180 seconds was calculated with an average episode download time of a few minutes each.
There is no harm in multiple Plex scans of the same season folder, except for more busyness of Plex, and perhaps more stress to it, so this delay will try to alleviate that.
Alternative recommended settings are: 120 and 90 seconds.