rakshasa / rtorrent

rTorrent BitTorrent client
https://github.com/rakshasa/rtorrent/wiki
GNU General Public License v2.0
4.05k stars 412 forks source link

Adding torrents with ratio group programmatically #1199

Open Spedwards opened 1 year ago

Spedwards commented 1 year ago

I currently have a seedbox running rtorrent (v0.9.6) and rutorrent (v3.9). I'm setting up FlexGet with the rtorrent plugin and am trying to correctly setup how a torrent gets added.

I have successfully figured out how to add torrents with a correct label and save location but there are things I cannot figure out. Unfortunately the plugin's documentation is sparse at best with no details on what the custom1 through to custom5 fields are supposed to be. custom happened to line up with the torrent's label, however after testing the other fields, there doesn't appear to be any way to set the ratio group to be used, nor a toggle for "Don't add torrent's name to path".

I imagine I'll have to fork FlexGet's rtorrent plugin to be able to add these, but I was hoping someone could point me which values I'd need to set for these.

EDIT: Just to provide some extra details, the ratio details I'd want to set in this particular case are as follows:

Min,% Max,% UL,MiB Time,h Action
350 500 20 -1 Stop
kannibalox commented 1 year ago

Unfortunately the plugin's documentation is sparse at best with no details on what the custom1 through to custom5 fields are supposed to be. custom happened to line up with the torrent's label

They are just that, custom fields that can be used for whatever another app wants to use them for. ruTorrent happens to use custom1 as the label, but there's no actual significance to it.

there doesn't appear to be any way to set the ratio group to be used, nor a toggle for "Don't add torrent's name to path".

I just looked at the plugin code and there is most definitely not. It would need to use the d.directory_base.set command to support that, for reference.

If you just want a torrent loaded from flexget to get assigned to a pre-existing ruTorrent ratio group, I think all you need to do is have the new item inserted into the right view:

view.set_visible=<hash>,rat_<ratio group num>
Spedwards commented 1 year ago

I just looked at the plugin code and there is most definitely not. It would need to use the d.directory_base.set command to support that, for reference.

Thanks, this is helpful. I just wanted to confirm something though. On line 355 of the rtorrent plugin (https://github.com/Flexget/Flexget/blob/develop/flexget/plugins/clients/rtorrent.py#L355), they have the following:

self._server.d.set_directory(info_hash, dst_path)

I imagine that this is the equivalent to d.directory.set. To get my desired effect, I would have to change it to the equivalent of d.directory_base.set, or am I misunderstanding the documentation and this has to be an additional command?

UPDATE: I haven't figured out a perfect solution that works for me (for some reason some flags aren't working?) but I was able to have the torrent name omitted from directory paths within the RTorrentPluginBase class of the plugin under the if options.get('path') condition (https://github.com/Flexget/Flexget/blob/develop/flexget/plugins/clients/rtorrent.py#L397). The previous point was only used for updating a torrent, which I'm not using.

kannibalox commented 1 year ago

I imagine that this is the equivalent to d.directory.set. To get my desired effect, I would have to change it to the equivalent of d.directory_base.set, or am I misunderstanding the documentation and this has to be an additional command?

UPDATE: I haven't figured out a perfect solution that works for me (for some reason some flags aren't working?) but I was able to have the torrent name omitted from directory paths within the RTorrentPluginBase class of the plugin under the if options.get('path') condition (https://github.com/Flexget/Flexget/blob/develop/flexget/plugins/clients/rtorrent.py#L397). The previous point was only used for updating a torrent, which I'm not using.

It's very possible I'm misunderstanding how the plugin works and hopefully that fixes it for you, but yes, d.set_directory is the deprecated form of d.directory.set, and only one of that or d.directory_base.set would need to be used: https://rtorrent-docs.readthedocs.io/en/latest/cmd-ref.html#term-d-directory-base