[Linux] rtorrent amc supplemental guide

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
ikkuranus
Posts: 2
Joined: 23 May 2018, 19:00

[Linux] rtorrent amc supplemental guide

Post by ikkuranus »

I recently made the journey from Windows with Qbittorent to an Ubuntu 16.04 server NAS with Rtorrent 0.9.6. After doing the Initial setup and configuration of rtorrent, filebot, and the amc post-process script I realized that Rtorrent defaults to saving torrent data to the same directory as torrents that are still downloading. The problem with that is amc processes and excludes files/folders that aren't ready if you happen to be downloading multiple torrents.

The proper setup is as follows:
in .rtorrent.rc change the default directory to

Code: Select all

directory = /path/to/downloading
Create the above directory and if it's not in the rtorrent home directory then assign permissions to it.
personally I'm using /media/d5/downloading

Next, you need to insert the following into .rtorrent.rc

Code: Select all

method.insert = d.get_finished_dir, simple, "cat=~/Download/,$d.custom1="
method.insert = d.data_path, simple, "if=(d.is_multi_file), (cat,(d.directory),/), (cat,(d.directory),/,(d.name))"
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="
Make sure to change "cat=~/Download/,$d.custom1=" to where you actually intend to move data to after it is finished downloading
I'm using "cat=/media/d5/downloads/,$d.custom1="
taken from: https://github.com/rakshasa/rtorrent/wi ... d-location

Lastly I discovered that rtorrent was running the postprocess first and then moving the completed download to its proper resting place which results in a never-ending cycle of the last torrent not getting processed until a new torrent is downloaded. After chatting with the fine folks in #rtorrent on Freenode they told me that, "A multi command is an array of simple commands, indexed by a name. When you call a multi-command, the sequence is executed in order of the keys used when defining a single command of the sequence." -Pyroscope

In this case you likely have the following 2 keys in .rtorrent.rc
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="
method.set_key = event.download.finished,filebot,"execute={/home/user/rtorrent-postprocess.sh,$d.base_path=,$d.name=,$d.custom1=}"

Since event.download.finished. is the same and filebot starts with an F it will always run before move_complete which starts with an M. To fix that I simply added a z in front of filebot (event.download.finished,zfilebot) to put it at the end.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Linux] rtorrent amc supplemental guide

Post by rednoah »

$d.data_path looks interesting, as opposed to $d.base_path.

What would happen if you didn't move files after download, and instead passed $d.data_path directly into filebot for processing?

Code: Select all

method.set_key = event.download.finished,filebot,"execute={/home/user/rtorrent-postprocess.sh,$d.data_path=,$d.name=,$d.custom1=}"
:idea: Please read the FAQ and How to Request Help.
ikkuranus
Posts: 2
Joined: 23 May 2018, 19:00

Re: [Linux] rtorrent amc supplemental guide

Post by ikkuranus »

I honestly don't know but maybe when I have some free time tomorrow I'll give it a shot.
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [Linux] rtorrent amc supplemental guide

Post by rednoah »

Considering the post above, $d.data_path is a variable that isn't defined by default.

It might be interesting to modify rtorrent-postprocess.sh and pass is_multi_file, directory and name and then call the amc script accordingly with --def ut_kind / ut_dir / ut_name:

Code: Select all

rtorrent-postprocess.sh,$d.is_multi_file=,$d.directory=,$d.name=,$d.custom1=
:arrow: rtorrent-postprocess.sh needs to be modified for that, but it would be really interesting what argument values are pass in if you call it like that. That way we could update the rtorrent integration and make things work better for everyone.
:idea: Please read the FAQ and How to Request Help.
Post Reply