Skip to content

Instantly share code, notes, and snippets.

@jpcaparas
Forked from stokkes/README.md
Created August 14, 2019 08:38
Show Gist options
  • Save jpcaparas/41e84c0ee32c4efe877587efd9887fac to your computer and use it in GitHub Desktop.
Save jpcaparas/41e84c0ee32c4efe877587efd9887fac to your computer and use it in GitHub Desktop.
Rclone Plex Sonarr Radarr Read&Write

Rclone v1.40 for Plex/Sonarr/Radarr Read/Write

This small guide should help you get setup with rclone v1.40 to read/write directly to a cache mount and have Plex get notified of new tv/movies that get added to the mount by Radarr/Sonarr

Assumptions

  1. You're using rclone v1.40
  2. You're using Radarr & Sonarr
  3. If you're using docker for plex/sonarr/radrr, you must ensure the volumes attached to the containers are all the same path, i.e.: /mnt/user/media:/media for all 3. If not, the auto-scan will likely not work properly.

Step 1 - Configure rclone systemd service (file: rclone.service)

  1. Copy the file attached to this gist to /etc/systemd/system
  2. If you're not using Docker, remove the After=docker.service and Requires=docker.service
  3. Modify the file so that your rclone remote, mount point, cache-tmp-upload-path, cache-db-path are configured for your environment. NB: the rclone mount point is your rclone cache remote OR your rclone crypt remote if using Crypt (see Step 2)
  4. Enable the systemd daemon: sudo systemctl daemon-reload && sudo systemctl enable rclone.service

Step 2 - Configure rclone cache (or cache->crypt) remote (file: rclone.conf)

NB: If you're using crypt, your remotes must be configured this way: remote->cache->crypt (do not do remote->crypt->cache!)

  1. Configure a new rclone cache remote and ensure your settings match the ones in the file below. The cache remote points to a regular remote, i.e.: gd: for Google Drive (or whatever name you have for your GDrive remote)
  2. Ignore the crypt remote gmedia: if you're not using crypt and just use the provided example remote gcache:

We set most of the settings during mount in the rclone.service file, so I'd set these to the same value when configuring them using rclone config to avoid confusion.

Step 3 - Configure Radarr / Sonarr Plex integration (no file)

In Radarr or Sonarr, configure the Plex Media Server integration (steps are the same in both Radarr/Sonarr):

  1. Click on Settings
  2. Click on the Connect tab
  3. Click the + button to create a new connection
  4. Choose Plex Media Server
  5. Give it a name (anything you want)
  6. Ensure the following are set to Yes: On Download, On Upgrade, On Rename
  7. Set your Plex host (localhost or the name of your plex container should work here)
  8. Leave port to 32400
  9. Put your Plex.tv Username / Password
  10. Ensure Update Library is set to Yes
  11. Set SSL to No

Now when Sonarr/Radarr download, upgrade, or rename a file, it will fire an event to Plex to update that folder. Sonarr/Radarr will have direct read/write access to the mount. Any new file will get placed by rclone in the folder defined by --cache-tmp-upload-path and get uploaded during the next interval defined by --cache-wait-time.

Step 4

There is no Step 4, that should be sufficient to get you going!

[gd]
type = drive
client_id =
client_secret =
token =
[gcache]
type = cache
remote = gd:Media
plex_url = http://127.0.0.1:32400
plex_username = USERNAME
plex_password = PASSWORD
plex_token = TOKEN
chunk_total_size = 50G
[gmedia]
type = crypt
remote = gdcMedia:
filename_encryption = standard
directory_name_encryption = true
password = PASSWORD
password2 = PASSWORD
# /etc/systemd/system/rclone.service
# If you're not using Docker, remove
# the two docker.service lines below.
[Unit]
Description=rclone cache mount for google drive
AssertPathIsDirectory=/home/user/mnt/media
After=network-online.target
After=docker.service
Requires=docker.service
[Service]
Type=simple
User=stokkes
Group=stokkes
ExecStart=/usr/bin/rclone mount gmedia: /home/user/mnt/media \
--allow-other \
--allow-non-empty \
--dir-cache-time=160h \
--cache-chunk-size=10M \
--cache-info-age=168h \
--cache-workers=5 \
--attr-timeout=1s \
--syslog \
--umask 002 \
--rc \
--cache-tmp-upload-path /home/user/.config/rclone/upload \
--cache-tmp-wait-time 30m \
--cache-db-path /home/jarsenea/.config/rclone \
--log-level INFO
ExecStop=/bin/fusermount -uz /home/user/mnt/media
Restart=on-abort
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
[Install]
WantedBy=default.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment