Highly recommend plex_autoscan!

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51

Discovered Plex Autoscan a few weeks ago and love it so far. As far as I know it's not containerized but I could be wrong, but you can install it on the host, it's a python based app and compatible with Plex docker. The setup can be a little daunting but when you get it setup properly it requires no care/feeding, and works great. Here's some of the benefits I've learned/leveraged:

No more Plex scans through tons of dirs for library updates, it monitors your gdrive for adds/removes/changes/deletes on your media folders, once detected it ensures the file is showing up in your mapped mounts, then notifies Plex to update that specific item in a targeted manner.

It keeps a DB of your items so it can see what is missing and have it added.

It can empty trash in Plex but can be configured to only do so if mount is mounted and/or if there's not more than x items in trash (so it doesn't empty mass items in the event of a config issue)

When you connect sonarr/radarr to it, it can fix incorrect matches in Plex to their correct matches.

So far it works great and is far more efficient for large libraries. For the record I have no affiliation with this project, just a fan and wanted to share.

Ed
 

vFlagR

Respected Member
Staff
Local time
10:12 AM
Aug 27, 2018
94
51
Glasgow, Scotland
This looks and sounds really interesting and after having nothing but issues with plex scanning I'm down to try anything. Will edit my comment when I have a chance to play around and let others know my experience too :)
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Great, let us know. Forgot to mention it supports encrypted mounts too.
 

vFlagR

Respected Member
Staff
Local time
10:12 AM
Aug 27, 2018
94
51
Glasgow, Scotland
Do you have a copy of the config you used without any passwords/keys I could use a copy of? Like you mentioned the initial set up does look a bit daunting/time consuming haha.
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
My config is slightly different since I tied it to external, non docker plex, and most of it is plugging in the paths, mappings and your oauth keys. Which section are you stuck on?
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
If you want to post here or direct msg me with your config (scrub keys first) I'm happy to help!
 

vFlagR

Respected Member
Staff
Local time
10:12 AM
Aug 27, 2018
94
51
Glasgow, Scotland
I never saw your reply, my apologies. I ended up spending a couple of days messing around I've had plex_autoscan running for a few days now. I'm not sure my config is 100% correct but it seems to be doing it's job pretty efficiently :D

Thanks for the recommendation!
 

skuid87

Junior Member
Donor
Local time
10:12 AM
Sep 26, 2018
17
3
Thanks for sharing!

I was under the impression that this was already happening when you add PMS to 'Connect' in Radarr/Sonarr.
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Sort of. That's if sonarr/radarr handled the import. And if your Plex server is down, it won't queue the request. Also as far as I know sonarr/radarr don't fix incorrect matches in Plex, and radarr just kicks off an entire movie lib scan on new movie import. Autoscan keeps a DB of your gdrive and Plex DB, so it can find Delta's and request scans, it also will requeue failed items if they don't show up in the DB or the request fails. It also does targeted scans, I.e. instead of scanning the entire movie library, it scans the specific new movie folder.

The other nice benefit is if you have multiple Plex servers, sometimes sonarr will send the "new item" notice before rclone is done uploading, so Plex will scan and not see anything new. Autoscan confirms the file is visible in the mount before sending the request.

I also really like the safe trash emptying. If rclone dismounts and you have Plex set to auto empty trash, there goes your entire library index. Autoscan will check that mount is mounted first, then empty, and can even be set to only empty if items in trash do not exceed a $ you set.
Post automatically merged:

I forgot to mention, you can connect sonarr/radarr to autoscan as a "man in the middle." Autoscan will then wait until the file shows up in the mount, then do a targeted update to plex and ensure the show/movie is correctly matching the tmdb/tvdb ID. If Plex or mount is down is down, it will queue the request until both are back up. (You need to enable the DB function in the config for the queuing to work.)
 
Last edited:
  • Like
Reactions: skuid87

pakira

Junior Member
Donor
Local time
12:12 PM
May 4, 2018
22
8
Is there any good guide to install is in plexguide?
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
I don't believe it's containerized so it would need to be installed on the host itself.
 

timetrex

Senior Member
Staff
Local time
10:12 AM
Oct 22, 2018
159
34
Belfast
I think PlexGuide have it setup, so think it could be included in plexguide to make it easier to setup.
 
  • Like
Reactions: pakira

indochild

Full Member
Local time
2:12 AM
Mar 13, 2018
39
20
I’d love to see a guide on how to implement for a complete novice (myself)
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Actually it looks like a docker container exists but it's the Plex server couples with Plex Autoscan in one container. https://hub.docker.com/r/horjulf/plex_autoscan/

With regards to a guide, the readme in the original post is pretty comprehensive. It's somewhat difficult to create a "canned config" since most of the config is unique to you such as oauth keys, gDrive/TeamDrive paths, mnt paths, etc. It probably took me about 30m to create the first config and another 30m of tweaking it after, so it takes a little effort but it's not too bad.
 
  • Like
Reactions: pakira

pakira

Junior Member
Donor
Local time
12:12 PM
May 4, 2018
22
8
I took more than 30 min o_O but it is working like a charm :p for movies and tv. I haven't check the Music. the below config is working for me, you just need to update TOBEUPDATED for google client details, plex token and serverpass

JSON:
{
  "DOCKER_NAME": "plex",
  "GOOGLE": {
    "ALLOWED": {
      "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"
      ],
      "FILE_PATHS": [
        "PG/movies/",
        "PG/tv"
      ],
      "MIME_TYPES": true,
      "MIME_TYPES_LIST": [
        "video"
      ]
    },
    "CLIENT_ID": "TOBEUPDATED",
    "CLIENT_SECRET": "TOBEUPDATED",
    "ENABLED": true,
    "POLL_INTERVAL": 120,
    "SHOW_CACHE_LOGS": true,
    "TEAMDRIVE": true,
    "TEAMDRIVES": [
    "PG"
    ]
  },
  "PLEX_ANALYZE_DIRECTORY": true,
  "PLEX_ANALYZE_TYPE": "basic",
  "PLEX_CHECK_BEFORE_SCAN": false,
  "PLEX_DATABASE_PATH": "/opt/appdata/plex/database/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_FIX_MISMATCHED": false,
  "PLEX_FIX_MISMATCHED_LANG": "en",
  "PLEX_LD_LIBRARY_PATH": "/usr/lib/plexmediaserver/lib",
  "PLEX_LOCAL_URL": "https://plex.domain.name:443",
  "PLEX_SCANNER": "/usr/lib/plexmediaserver/Plex\\ Media\\ Scanner",
  "PLEX_SUPPORT_DIR": "/var/lib/plexmediaserver/Library/Application\\ Support",
  "PLEX_TOKEN": "TOBEUPDATED",
  "PLEX_USER": "plex",
  "PLEX_WAIT_FOR_EXTERNAL_SCANNERS": true,
  "RCLONE": {
    "BINARY": "/usr/bin/rclone",
    "CONFIG": "/opt/appdata/plexguide/rclone.conf",
    "CRYPT_MAPPINGS": {},
    "RC_CACHE_REFRESH": {
      "ENABLED": false,
      "FILE_EXISTS_TO_REMOTE_MAPPINGS": {
        "Media/": []
      },
      "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": {
    "/home/user/rclone/": []
  },
  "SERVER_IGNORE_LIST": [
    "/.grab/",
    ".DS_Store",
    "Thumbs.db"
  ],
  "SERVER_IP": "0.0.0.0",
  "SERVER_MAX_FILE_CHECKS": 10,
  "SERVER_PASS": "TOBEUPDATED",
  "SERVER_PATH_MAPPINGS": {
    "/mnt/unionfs/movies/": [
      "/mnt/unionfs/movies/",
    "PG/movies/"
    ],
    "/mnt/unionfs/tv/": [
      "/mnt/unionfs/tv/",
        "PG/tv/"
    ]

  },
  "SERVER_PORT": 3467,
  "SERVER_SCAN_DELAY": 180,
  "SERVER_SCAN_FOLDER_ON_FILE_EXISTS_EXHAUSTION": false,
  "SERVER_SCAN_PRIORITIES": {
    "0": [
      "/Movies/"
    ],
    "1": [
      "/TV Shows/"
    ],
    "2": [
      "/Music/"
    ]
  },
  "SERVER_USE_SQLITE": false,
  "USE_DOCKER": true,
  "USE_SUDO": true
}
Post automatically merged:

 
Last edited:

indochild

Full Member
Local time
2:12 AM
Mar 13, 2018
39
20
Did you install it directly on the server or did you install the container above?
 

pakira

Junior Member
Donor
Local time
12:12 PM
May 4, 2018
22
8
Directly on the server and follow the install steps on https://github.com/l3uddz/plex_autoscan


  1. cd /opt/appdata
  2. sudo git clone https://github.com/l3uddz/plex_autoscan
  3. sudo chown -R 1000:1000 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. /opt/appdata/plex_autoscan/config/config.json - Configure settings (do this before moving on).
  8. sudo nano /opt/appdata/plex_autoscan/system/plex_autoscan.service -to update appdata in the path
  9. sudo cp /opt/appdata/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
 

indochild

Full Member
Local time
2:12 AM
Mar 13, 2018
39
20
i can't seem to connect to the webhook server. do i need to turn off port protection or my reverse proxy?
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
You shouldn't need to. I'm surprised 0.0.0.0 is working for the previous poster but 127.0.0.1 should work for the Plex server ip

Disregard, I misread the op's config. The 0.0.0.0 was the webhook listen ip (0.0.0.0 means all interfaces)
 
Last edited:
  • Like
Reactions: indochild

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Awesome! Consider changing use sqllite to true so it can keep a DB and queue of your items. Also if you want it to fix mismatched items in Plex based on sonarr/radarr ID's, change fiz_mismatch to true.
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Oh for the IP in sonarr, put the actual ip of the host box. If you use cloudflare do not use a cloudflare proxied DNS name, just the actual IP address of the host nic. Also, I think the documentation says port 3468 but the sample config has 3467, so check the actual port defined in your config file.
 

indochild

Full Member
Local time
2:12 AM
Mar 13, 2018
39
20
It keeps throwing an error in sonarr & radarr. are you able to access it remotely through your web browser by going to http://ip:port/server_pass?
 

indochild

Full Member
Local time
2:12 AM
Mar 13, 2018
39
20
Got it Working! looks like i didnt follow the
sudo nano /opt/appdata/plex_autoscan/system/plex_autoscan.service -to update appdata in the path

step correctly.
 
  • Like
Reactions: pakira

pakira

Junior Member
Donor
Local time
12:12 PM
May 4, 2018
22
8
Thanks for the advice. I setup with sqllite now.
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Good news is there is no setup really, you just edit the config line that says use sqllite from false to true.
 

kiityman

Junior Member
Local time
2:12 AM
Feb 1, 2020
18
3
California
Hey, I set this up but cannot access it at http://ip:3467/serverpass

Ports are open

This is the systemctl status

● 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 Fri 2020-03-13 17:04:21 PDT; 9s ago
Process: 1768 ExecStart=/opt/appdata/plex_autoscan/scan.py server --loglevel=INFO (code=exited, status=1/FAILURE)
Main PID: 1768 (code=exited, status=1/FAILURE)
 
Last edited:

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
Your service is failing to start. Try starting it in bash and paste the error here:
cd /opt/plex_autoscan
./scan.py server
 

homer8798

Noob
Local time
11:12 AM
Mar 13, 2020
1
4
have fun

download file
unpack zip local
upload unpacked files to /opt/plexguide/menu/pgscan

cd /opt/plexguide/menu/pgscan
bash pgscan.sh

automatic install of plexautoscan
 

Attachments

kiityman

Junior Member
Local time
2:12 AM
Feb 1, 2020
18
3
California

captains1stm8

Junior Member
Local time
5:12 AM
Dec 11, 2018
11
1
this seems like some valuable effort, and it's definitely appreciated. I still cannot get it to deploy. I get the same error as kiityman. I should say that I use the plexinc/pms-docker:latest image, although I tried what danielbmarshall suggested and set $plexcontainerversion" == "plexinc/pms-docker:latest" in pgscan.sh. Any ideas?
 

danielbmarshall

Junior Member
Local time
4:12 AM
Dec 23, 2018
5
1
Is the core.yml right for v8.7.5 in this? I had to copy the one from /opt/coreapps/apps/_core.yml to /opt/plexguide/menu/pgscan/yml/core.yml and change the owner for those files to deploy the container for my install.

I also needed to make adjustements for my $plexcontainerversion" == "linuxserver/plex:latest in the pgscan.sh in order to accomodate linuxserver/plex:beta
 

timetrex

Senior Member
Staff
Local time
10:12 AM
Oct 22, 2018
159
34
Belfast
once this is deployed do you change any scan settings in plex or do you take the connect function to plex off in radarr and sonarr?

Once you install the file above auto install - what next do you require to do?

I have it installed, I can get to the plexautoscan page - Do i need to do an inital scan of my plex library to build autoscan db?

In the config file there is client id and secret which is not done in the auto install - do we need to complete this?

In PlexGuide wiki it mentions uploading a control file to gdrive so plexautoscan can remove missing/replaced media files out of Plex (i.e. empty trash). Without it, Plex will be left with "unavailable" media that can't play (i.e. media posters with trash icons on them). - do we need this?
 
Last edited:

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
The web interface for plex_autoscan isn't really needed other than radarr/sonarr hooks, meaning you don't need to visit it.
In your config somewhere should be an empty trash control file called mounted.bin. Edit that path to your Google drive mount point. Then go to that mount point and type touch mounted.bin. I.e. if your config file says /mnt/gdrive/mounted.bin
Then in bash
cd /mnt/gdrive
touch mounted.bin

For Plex, I turned off all auto and scheduled scans. I also told Plex not to empty my trash after each scan.

In the config you can enable trash emptying and it's thresholds. I.e. if mounted bin exists, then empty trash as long as trashed items does not exceed 100 items.

The point of doing it this way is if you lose your internet connection or for whatever reason your drive becomes unmounted and Plex runs a scan with the auto trash emptying on in Plex, it will essentially wipe out your entire library (not the actual files but all the Plex indexes/metadata) meaning you would have to rescan in your entire library. This helps prevent that from happening.
 

FileLife

Junior Member
Local time
11:12 AM
Feb 24, 2018
5
0
Soo I got it working to the point that it scans the library. Now I'm getting the following error:

Code:
2020-03-17 19:03:57,211 -     INFO -      PLEX []: Scan request is now being processed...
2020-03-17 19:03:57,215 -     INFO -      PLEX []: Plex is available for media scanning - (Server Account: '**********************')
2020-03-17 19:03:57,216 -     INFO -      PLEX []: Running Plex Media Scanner for: /mnt/unionfs/movies/**********************
2020-03-17 19:03:57,245 -     INFO -     UTILS []: unable to find user NOT-SET: no matching entries in passwd file
2020-03-17 19:03:57,248 -     INFO -      PLEX []: Finished scan!
2020-03-17 19:03:58,255 -     INFO -      PLEX []: There are 0 queued item(s) remaining.
censored unnecessary lines

Plex isn't showing any new movies. And I'm not sure where "unable to find user NOT-SET: no matching entries in passwd file" comes from.
 

timetrex

Senior Member
Staff
Local time
10:12 AM
Oct 22, 2018
159
34
Belfast
I have it working now with sonarr and radarr. With the auto install the only thing I would change is the server checks and the delay. For me it was too quick. Sonarr / Radarr notified off file downloaded. Plexautoscan was triggering to see if file was there. Checked every 15 second for 5 times and then quitting. My file hadn't uploaded yet to my drive.

I changed that back to default 10 times every 60 seconds. That will work better.
 

Edrock200

Senior Member
Original poster
Local time
5:12 AM
Nov 17, 2019
193
51
You didn't edit your service file. :)


Sudo nano /etc/systemd/system/plex_autoscan.service

Edit the user and group to match your plexguide username.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.