Plex Automatic Scanning | PlexGuide.com

Plex Automatic Scanning

  • Stop using Chrome! Download the Brave Browser via >>> [Brave.com]
    It's a forked version of Chrome with native ad-blockers and Google's spyware stripped out! Download for Mac, Windows, Android, and Linux!
Welcome to the PlexGuide.com
Serving the Community since 2016!
Register Now

kamos69

Experienced+
Original poster
Donor
Apr 22, 2018
131
71
After PG Scan was shelved I set out to get the original script working for PG. This is a quick guide to getting it setup .

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

It does this by creating a webserver 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).
Steps:
  • Follow the installation steps on the github page
    • Don't follow the last step, i.e. don't start the service.
  • cd /opt/plex_autscan/config/
  • wget https://raw.githubusercontent.com/kamos69/scripts/master/config.json
    • Add your Plex token, you can use this script: sudo bash /opt/plex_autoscan/scripts/plex_token.sh
  • Update the startup file: sudo nano /etc/systemd/system/plex_autoscan.service
    • You need a user with elevated privileges to run the script, so change the following if necessary:
      • User=YOUR_USER -> User=0
      • Group=YOUR_USER -> Group=0
  • Reload the daemon: sudo systemctl daemon-reload
  • Start the service: sudo systemctl start plex_autoscan.service
  • You can monitor the service with: sudo tail -f /opt/plex_autoscan/plex_autoscan.log
There's more information about the script on the github page regarding manual triggers, Sonarr and Radarr setup, rclone integration, etc.

Credit to l3uddz for the script and @Bryde for the config.
 
Last edited:
  • Like
Reactions: 6 users

hooper

Governer
Staff
Donor
Aug 1, 2018
310
119
I can't get this to work even with the config provided.

here is the error I get just trying to run the python scan.py sections command


[email protected]:/opt/plex_autoscan$ python scan.py sections
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --loglevel=INFO
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --cachefile=cache.db
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --tokenfile=token.json
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --queuefile=queue.db
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --logfile=plex_autoscan.log
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --config=config/config.json

2018-09-12 16:55:29,722 - INFO - AUTOSCAN [XXXXXXXXXXXX]:
_ _
_ __ | | _____ __ __ _ _ _| |_ ___ ___ ___ __ _ _ __
| '_ \| |/ _ \ \/ / / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
| |_) | | __/> < | (_| | |_| | || (_) \__ \ (_| (_| | | | |
| .__/|_|\___/_/\_\ \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
|_|

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

2018-09-12 16:55:29,723 - INFO - PLEX [XXXXXXXXXXXX]: Using Plex Scanner



terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
what(): boost::filesystem::create_directories: Permission denied: "/config/Library/Logs"
****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /config/Library/Application Support/Plex Media Server/Crash Reports/1.13.7.5369-xxxxxxxx/PLEX MEDIA SCANNER/25f536d8-8ab1-ae64-xxxxxxx-xxxxxxxxx.dmp
bash: line 1: 26160 Aborted /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list
 

kamos69

Experienced+
Original poster
Donor
Apr 22, 2018
131
71
I can't get this to work even with the config provided.

here is the error I get just trying to run the python scan.py sections command


[email protected]:/opt/plex_autoscan$ python scan.py sections
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --loglevel=INFO
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --cachefile=cache.db
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --tokenfile=token.json
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --queuefile=queue.db
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --logfile=plex_autoscan.log
2018-09-12 16:55:29,599 - INFO - CONFIG [XXXXXXXXXXXX]: Using default setting --config=config/config.json

2018-09-12 16:55:29,722 - INFO - AUTOSCAN [XXXXXXXXXXXX]:
_ _
_ __ | | _____ __ __ _ _ _| |_ ___ ___ ___ __ _ _ __
| '_ \| |/ _ \ \/ / / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
| |_) | | __/> < | (_| | |_| | || (_) \__ \ (_| (_| | | | |
| .__/|_|\___/_/\_\ \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
|_|

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

2018-09-12 16:55:29,723 - INFO - PLEX [XXXXXXXXXXXX]: Using Plex Scanner



terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
what(): boost::filesystem::create_directories: Permission denied: "/config/Library/Logs"
****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /config/Library/Application Support/Plex Media Server/Crash Reports/1.13.7.5369-xxxxxxxx/PLEX MEDIA SCANNER/25f536d8-8ab1-ae64-xxxxxxx-xxxxxxxxx.dmp
bash: line 1: 26160 Aborted /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list
Looks like a permissions issue. Try running it with sudo: sudo python scan.py sections
 

kamos69

Experienced+
Original poster
Donor
Apr 22, 2018
131
71
I also realised that I didn't remove my Plex token from then config. I've updated the guide, you should user your own Plex Token.
 

hooper

Governer
Staff
Donor
Aug 1, 2018
310
119
I also realised that I didn't remove my Plex token from then config. I've updated the guide, you should user your own Plex Token.
I should have mentioned that I get the same error with sudo and I had also fixed the issue with the Plex token.

Are you able to successfully run the command I get this error on?
 

kamos69

Experienced+
Original poster
Donor
Apr 22, 2018
131
71
I should have mentioned that I get the same error with sudo and I had also fixed the issue with the Plex token.

Are you able to successfully run the command I get this error on?
Yes.

Code:
[email protected]:/opt/plex_autoscan$ sudo python scan.py sections
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --loglevel=INFO
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --cachefile=cache.db
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --tokenfile=token.json
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --queuefile=queue.db
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --logfile=plex_autoscan.log
 2018-09-13 16:54:20,562 -     INFO -    CONFIG [140235557062464]: Using default setting --config=config/config.json
 2018-09-13 16:54:20,666 -     INFO -  AUTOSCAN [140235557062464]:
        _                         _
  _ __ | | _____  __   __ _ _   _| |_ ___  ___  ___ __ _ _ __
 | '_ \| |/ _ \ \/ /  / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
 | |_) | |  __/>  <  | (_| | |_| | || (_) \__ \ (_| (_| | | | |
 | .__/|_|\___/_/\_\  \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
 |_|

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

 2018-09-13 16:54:20,666 -     INFO -      PLEX [140235557062464]: Using Plex Scanner
  4: Anime
  1: Movies
  7: Movies 4K
  2: TV Shows
  3: UFC
 

hooper

Governer
Staff
Donor
Aug 1, 2018
310
119
ok, I will smack the install of plex_autoscan and start fresh.

oh, one other question, do you run plexguide under a specific user or did you install with root?
 

kamos69

Experienced+
Original poster
Donor
Apr 22, 2018
131
71
ok, I will smack the install of plex_autoscan and start fresh.

oh, one other question, do you run plexguide under a specific user or did you install with root?
I run it with a specific user.
 

captngimpy

Experienced+
Staff
Mar 14, 2018
112
32
So I was able to get the plex auto scan setup and working but I am having some issues with it since i am using the sonarr/radarr mp4 automator docker images. Nzbget will download send a report to sonar/radarr which will then initiate the move to /mnt/move and do the convert then blitz kicks in and uploads the mp4 then the report gets sent to plex autoscan for it to watch for the file. Except it gets told the files original mkv name so it never ends up finding the file and doesn't scan. I have tried to set it to scan the directory if it fails to find a file but so far its not working. Wondering if you guys have any suggestions.
 

captngimpy

Experienced+
Staff
Mar 14, 2018
112
32
Yes because it actually triggers the Plex scanning service just with certain flags to only scan certain things.
 

daveftw84

Governer
Donor
Jan 18, 2018
270
33
can sonar and radar talk to it remotely?

---- Automatically Merged Double Post ----

cause I have a feeder and then the actual plex server. can I install this on the server and set it up the feeder to talk to it
 
Last edited:

captngimpy

Experienced+
Staff
Mar 14, 2018
112
32
They can and that's why I ran in to trouble since I'm running the mp4 conversion at the nzbget it has saved me a lot of work and time and saved my server a lot of over head from scanning through the whole library
 

Admin9705

Administrator
Project Manager
Donor
Jan 17, 2018
5,151
2,120
has anyone used the gdrive and tdrive cache monitor feature?
no don't use it. it's so slow. we tried this route before along time ago. and we would hit api bans ironically easy with it.
 

daveftw84

Governer
Donor
Jan 18, 2018
270
33
ok, i have the radar and sonar set. it said it couldn't find a movie and gave up. so I set the delay to 10 mins. give it time to upload but your comment about so slow has me thinking if that was a good idea

---- Automatically Merged Double Post ----

but it looks like its working

---- Automatically Merged Double Post ----

maybe not PLEX [140372190652160]: File '/unionfs/tv/AFV/Season 29/America's Funniest Home Videos - S29E06 - Work Mishaps, Beach Birds, and Small Animal Scares WEBDL-720p.mkv' did not exist on check 1 of 10, checking again in 60 seconds.

---- Automatically Merged Double Post ----

[email protected]:/home/customer# ls '/mnt/unionfs/tv/AFV/Season 29'
AFV - S29E01 - Winter Blunderland, Prank You Very Much, and #NotTrending WEBDL-720p.mkv AFV - S29E04 - Animal Thieves, Climbing Fails, and Wax Off WEBDL-720p.mkv
AFV - S29E02 - Soccer Fails, Party Fouls, and Doggy Disappearing Acts WEBDL-720p.mkv America's Funniest Home Videos - S29E05 - Costume Catastrophes, Spooky Scares, and Smashing Pumpkins WEBDL-720p.mkv
AFV - S29E03 - Money Mishaps, Hair Cuts Get Hairy, and A New Grandma WEBDL-720p.mkv America's Funniest Home Videos - S29E06 - Work Mishaps, Beach Birds, and Small Animal Scares WEBDL-720p.mkv

[email protected]:/home/customer# sudo tail -f /opt/plex_autoscan/plex_autoscan.log
#########################################################################
2018-11-05 03:10:27,630 - INFO - AUTOSCAN [140372257097472]: Starting server: http://0.0.0.0:3467/pass
2018-11-05 03:22:18,955 - INFO - AUTOSCAN [140372257097472]: Client '198.204.243.242' scan request for series: '/unionfs/tv/AFV/Season 29/America's Funniest Home Videos - S29E06 - Work Mishaps, Beach Birds, and Small Animal Scares WEBDL-720p.mkv', event: 'Download'

---- Automatically Merged Double Post ----

_ __ | | _____ __ __ _ _ _| |_ ___ ___ ___ __ _ _ __
| '_ \| |/ _ \ \/ / / _` | | | | __/ _ \/ __|/ __/ _` | '_ \
| |_) | | __/> < | (_| | |_| | || (_) \__ \ (_| (_| | | | |
| .__/|_|\___/_/\_\ \__,_|\__,_|\__\___/|___/\___\__,_|_| |_|
|_|
#########################################################################
# Author: l3uddz #
# URL: https://github.com/l3uddz/plex_autoscan #
# -- #
# Part of the PlexGuide project: https://PlexGuide.works #
#########################################################################
# GNU General Public License v3.0 #
#########################################################################
2018-11-05 04:16:29,258 - INFO - PLEX [140525730244352]: Using Plex Scanner
bash: /usr/lib/plexmediaserver/Plex Media Scanner: No such file or directory
[email protected]:/opt/plex_autoscan#
 
Last edited:

daveftw84

Governer
Donor
Jan 18, 2018
270
33
I got it,
was making a config.json2 on mistake. there was already an file before downloading your config
 

captngimpy

Experienced+
Staff
Mar 14, 2018
112
32
I am actually planning on updating here in the next couple days to try out the auto tdrive scanning
 
  • Like
Reactions: 1 user

daveftw84

Governer
Donor
Jan 18, 2018
270
33
ERROR - PLEX [140692894496512]: Could not loc ate record in media_parts where file = '/unionfs/tv/Orphan Black/Season 2/Orphan Black - S02E10 - By Means Which Have Never Yet Been Tried Bluray-1080p.mkv', 1/

---- Automatically Merged Double Post ----

it was working , now its not. keep getting these
 
Last edited:

Recommend NewsGroups

      Up To a 58% Discount!

Trending