Auto Upload for Sonarr and Lidarr - n05urpr1532-MHA-Team/PTS-Team GitHub Wiki

Table of Contents

  1. Intro to Automation, welcome to 2019 bois
  2. The Script
  3. Connect to Sonarr

THIS IS NOT NEEDED or USED BY PTS!

Use at your own risk, it's possible you can do things that will conflict and cause problems with PTS operations and operating behaviors.

1. Intro to Automation, welcome to 2019 bois

The script is pretty simple to use. Just edit the "NAMEOFSCRIPTHERE.sh" with whatever you want to name the script and "RCLONE COMMAND HERE" with the command you want to use for rclone.

Features of this simple 5 line script

  • Checks if it's already running so it doesn't run over itself.
  • Basically any rclone command can be put into here.
  • Can be added to Sonarr/Lidarr to have it run after it imports an item. (Auto upload after completion)

Some things to note

  • Your rclone needs to be callable normally. IE, You type rclone copy... if you get an error do which rclone and add that with your command instead of only rclone so you end up with /usr/bin/rclone copy....
  • Name of script needs to match the name you give in the script as that looks for itself in the processes to check if theres a job already running.
  • Script needs to be chmod +x so Sonarr/Lidarr can run it. AFAIK anything that can run a script will be able to run this script. Only tested with Sonarr/Lidarr.

2. The Script

#!/bin/bash
if pidof -o %PPID -x "NAMEOFSCRIPTHERE.sh"; then
exit 1
fi
RCLONE COMMAND HERE
exit

3. Connect to Sonarr

  1. Visit Sonarr page
  2. Go to Settings>Connect>Custom Script.
  3. Configure it similar to the screenshot below.

If you have rename, toggle "On Rename". Same applies if you have upgrades for files.