Plex with rclone mount - possible to auto update/partial scan?

My rclone cache mount has been working flawlessly but now there’s just one little annoyance. I know that the 2 options “Update my library automatically” and “Run a partial scan when changes are detected” won’t work with fuse mount. So I’m currently having PMS auto update library every hour.

I have about 15TB of TV/Movies which takes the scanner about 30 mins to finish scanning everything. This sucks if I’m just waiting on 1 TV episode to refresh in my library. Sure I can manual refresh, but what’s the point. My questions:

  1. Does it usually take this long? I’m using filebot’s amc script for renaming so files are named correctly. I’m on an older desktop and HDD (would hardware make any noticeable difference)?

  2. Any workaround/scripts to enable partial scans with rclone mount?

Yeah, use plex autoscan:

It works very well and does partial scans. Once everything is analyzed in plex, it should be a very quick scan though. A slower plex library HDD would slow things a little, but not that much. I run mine on a SSD.

1 Like

@omanko @Animosity022

Few things…

  1. If everything is on one server, I’d suggest using Sonarr/Radarr to download and rename instead of file bot. You can use the built-in Sonarr/Radarr integration to trigger a plex scan (it’s under the “Connect” feature in Sonarr/Radarr) when a new episode/movie is downloaded. The Plex integration works in a way that it will only scan the folder that was changed by Sonarr/Radarr (so for example, a new episode of a tv show, Plex will only scan the Season folder). It happens very quickly so new episodes after they are moved with Sonarr/Radarr will end up in Plex within a minute or so.

  2. If you have different servers for downloading and Plex, you can use plex_autoscan, but I’ll shamelessly plug my new program plex_rcs (https://github.com/stokkes/plex_rcs). Plex_rcs works by monitoring the rclone cache log and when it detects a cache expiration notification (new file on Google Drive), it will trigger a scan immediately of the folder that was modified, so shows should appear very quickly there as well. It integrates with Plex directly so it compares the folder that was just modified by rclone against your Plex library, matches the section and updates only the folder in question. Configuration is pretty simple compared to plex_autoscan.

In my setup I have 2 servers (downloader / plex) and I use rclone cache on both. Within about 5-10 minutes of downloading something on my downloader, I see it on my remote Plex server using plex_rcs. This is pretty good if you have 2 servers.

1 Like

I’m setup exactly as you describe in #1. All in one and I use Sonarr/Radarr for all my naming needs with plex autoscan.

@omanko - You’d be interested in his #2 program :slight_smile:

@Animosity022

You know you don’t really need plex_autoscan if you have an all-in-one and use rclone cache. Plex_autoscan was built specifically for multiple boxes (or users using Plexdrive).

Why not just go into Sonarr -> Settings -> Connect -> Add new, choose “Plex Media Server”, put in the address (likely localhost) and port, along with your Plex user/pass and everything will be done by Sonarr/Radarr?

If you’re using rclone cache (along with the new magical --cache-tmp-upload-path setting, it’s simpler that way.

I think this is your bug reported ->

Once that is fixed, I wouldn’t need need plex autoscan, but it seems to expire the folder if something new is added, no? I had some issues with stuff not being properly found and that was my use for plex autoscan (other than it limits the scans down a little bit by hitting the folder rather than the whole thing).

Yes, that is my bug, but it’s a dupe of:

https://github.com/new/rclone/issues/2155

However, it only affects things when rclone cache is running on two servers. I ran rclone cache on 1 server for nearly 4 months and didn’t have any issues you mention. New episodes, movies would be downloaded by radarr/sonarr and added to plex almost immediately.

Not just me. A few posts about it:

I would get the issue mainly from media being upgraded and I didn’t dig much into it as dropping plex autoscan in made the problem go away.

I also use it for the empty trash feature as routinely, my shows and movies get upgraded to better quality and it safely empties the trash for me without deleting more the ‘x’ configured items or it aborts. It saves me the trouble of emptying the trash.

Ah I know why

I went “all in” on rclone cache, so I let Sonarr/Radarr write directly to the cache mount (I don’t use UnionFS or anything), so the cache is never updated from anywhere outside (when I ran an all-in-one), so the “directory” bug never affected me until I moved to a 2-server setup.

I can see if you’re using unionfs/overlayfs/etc and doing an rclone move or rclone copy your local files to Google Drive, yes you will be impacted. But Honestly, no issues here allowing Sonarr/Radarr to write directly and manipulate files directly on the cache mount.

Awesome stuff @Stokkes However, I’m getting a crash and permission error when the program detects the change:

Starting to monitor /var/log/syslog with pattern for rclone cache
Detected new file: test/Copy of The Big Bang Theory - S11E23 - The Sibling Realignment.mkv

Processing section 5, folder: /home/omanko/plex/mount/test
terminate called after throwing an instance of 'std::runtime_error'
  what():  Codecs: Initialize: 'boost::filesystem::create_directories: Permission denied: "/var/lib/plexmediaserver/Plex Media Server/Codecs"'
****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /var/lib/plexmediaserver/Plex Media Server/Crash Reports/1.12.2.4929-29f6d1796/PLEX MEDIA SCANNER/0cb0124b-590d-7303-7ee88470-4fb23a38.dmp
Detected new file: test/DARK-KNIGHT-RISES_TLR-F1_51-1080p-HDTN.mp4

Processing section 5, folder: /home/omanko/plex/mount/test
terminate called after throwing an instance of 'std::runtime_error'
  what():  Codecs: Initialize: 'boost::filesystem::create_directories: Permission denied: "/var/lib/plexmediaserver/Plex Media Server/Codecs"'
****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /var/lib/plexmediaserver/Plex Media Server/Crash Reports/1.12.2.4929-29f6d1796/PLEX MEDIA SCANNER/4d72dfc1-54f3-1706-19d091bd-155b95e8.dmp

Permissions look fine though /var/lib/plexmediaserver/Library/Application Support/Plex Media Server:

drwxr-xr-x 10 plex plex 4096 May  3 22:59 .
drwxr-xr-x  3 plex plex 4096 Apr  8 14:08 ..
drwxr-xr-x  5 plex plex 4096 May  3 23:17 Cache
drwxr-xr-x  3 plex plex 4096 Apr  8 14:08 Codecs
drwxr-xr-x  3 plex plex 4096 Apr  8 14:08 Crash Reports
drwxr-xr-x  3 plex plex 4096 May  3 22:39 Logs
drwxr-xr-x  3 plex plex 4096 Apr  8 14:21 Media
drwxr-xr-x  4 plex plex 4096 Apr 10 19:17 Metadata
-rw-r--r--  1 plex plex    5 May  3 10:59 plexmediaserver.pid
drwxr-xr-x  3 plex plex 4096 Apr 30 05:19 Plug-ins
drwxr-xr-x  7 plex plex 4096 Apr  8 14:08 Plug-in Support
-rw-------  1 plex plex 1497 May  3 22:59 Preferences.xml

My setup passes all the requirements, I think. rclone mount is at /home/omanko/plex/mount, cache is at /home/omanko/plex/cache/gbcache. File structure is exactly the same. PMS is not in a docker.

Is this due to the fact I’m not running as plex user? Do I just do sudo chown -R user:plex /var/lib/plexmediaserver

@omanko

Please open an issue on Github and let’s take the discussion there.

Thanks!

@Stokkes - How do you deal with a TV show or something that’s being updated? Say you take a 720p to an 1080p version? I manually had to empty the trash to get the unavailable 720p off the list. I use plex_autoscan to do that now as my incredibly high maintenance user (wife) doesn’t seem something unavailable and create confusion.

I think you are correct as to once the polling issue was resolved, the majority of the items went away as I was the in the process of moving away from a mergerfs / rclone move and I’m all on board now with a cache_tmp_upload setup.

@Animosity022

I don’t store quality in the file names so when something gets upgraded, it has the same name.

Beeen doing this for a few years to simplify my setup.

@Stokkes hey for plex_rcs, can I use it if my plex isnt in a docker?

How can I test its working? I didnt really get your logger command :frowning:

Almost a year old topic. Closing.