Skip to content

Install SickGear [955] rTorrent

SickGear edited this page Feb 25, 2023 · 1 revision

SickGear Wiki: Home | Reporting Issues | Frequently Answered Questions | > Torrent Clients <

Setting up a rTorrent build to interact with SickGear

Part 2 of 2 (You must also complete Part 1 - To set up SickGear)

To recap...

  • Completed downloads are copied from a seeding location to an isolated location
  • SickGear will 'Move' processed content from isolation to the final show location

All four parameters are used to configure and run the script.

  1. If SickGear /config/Search/Torrent Results/"Send .torrent files to" is set "Black hole" then skip to step 2, otherwise, with it set to "rTorrent"...
    change Set torrent label... as custom# to value 1 (default=0).

  2. rTorrent can execute the onTxComplete script when every download completes by adding the following line to the .rtorrent.rc config file, (after any variable declarations, near or at the end of the file is safe)...

    • method.set_key=event.download.finished,copy_for_sickgear,"execute2={\"/path/to/sickgear/autoProcessTV/onTxComplete.sh\",\"<param1>\",\"<param2>\",\"$d.custom1=\",\"$d.base_path=\"}"

      for the config file line:
      a) Replace /path/to/sickgear/ with the SickGear installation path.
      b) Replace <param1> with the Completed TV downloads path configured in SickGear (Part 1 - a).
      c) Replace <param2> with the label configured in SickGear (Part 1 - e).

      when each download completes and onTxComplete is executed:

      • $d.custom1 at the <param3> position typically contains the value from the SickGear Set torrent label setting. Only complete downloads where $d.custom1 is equal to the <param2> value are filtered and used
      • $d.base_path at the <param4> position contains the downloaded item content path
      • "copy_for_sickgear" can be named anything, as long as something is actually defined for this isolated copy
      • Every double quote " in the execute2= text is escaped with a preceding \ to support white-space values
      • The = in any d.variable= is required by rT to handle variable content as text data

    An actual use case example:

    • method.set_key=event.download.finished,copy_for_sickgear,"execute2={\"/usr/local/sickgear/autoProcessTV/onTxComplete.sh\",\"/home/incoming/tv/sickgear/\",\"SG\",\"$d.custom1=\",\"$d.base_path=\"}"

Additionally, for Black hole or drop folder processing

If rTorrent is to load .torrent files dropped into an arbitary (or the SickGear "Black hole") folder to be processed by SickGear, then...

  1. Add the following line to the same config file as step 2...

    • schedule2 = watch_sg, 13, 60, ((load.start_verbose, (cat, "/path/to/the/black/hole/*.torrent"), d.custom1.set=<param2>))

      for the config file line:
      a) (cat, "/path/to/the/black/hole/*.torrent") tells rTorrent the path and to act on *.torrent files (path should match SickGear Black hole if in use).
      b) Replace <param2> with label to assign to added torrent tasks. (should match the SickGear set label (2c above).
      c) watch_sg is a name associated to the command so it may be changed programmatically.
      d) 13 tells rTorrent to start the command 13 secs after starting the program. Can be any number of secs.
      e) 60 tells rTorrent to execute the command every 60 secs after the first run. Can be any number of secs, the default is 10 secs in example files.
      f) load.start_verbose: load and start the torrent and the _verbose part will display any startup errors (could just use load.start instead).

    An actual use case example:

    • schedule2 = watch_sg, 13, 60, ((load.start_verbose, (cat, "/home/torrents/sickgear/*.torrent"), d.custom1.set=SG))

It's also possible to manually set the torrent label using the CLI by selecting a torrent to assign a label to, pressing CTRL+x and typing d.custom1.set=<param2> followed by Enter to execute it (where <param2> is the label); for example: d.custom1.set=SG

A label can be checked by selecting a torrent, pressing CTRL+x, and entering print=$d.custom1= followed by Enter.


In 2018, a challenge was put out for Linux rTorrent users to use this script...

  • something similar to the following in a rT config file should get you started... execute2={path/to/sickgear/autoProcessTV/onTxComplete.sh,<param1>,<param2>,$d.get_custom1,"$d.get_base_path"}

11 Mar 2022 -- Hope was long lost that a Linux user would ever step up and complete the challenge, but four years later, someone did, they found a fundamental Linux bug in the ported logic, and furthermore, created and very kindly donated this thoughtful guide - thank you SamKook - above and beyond legendary!

Clone this wiki locally