Automatic Transfer of downloaded torrents to the desired folder. How?

General support for problems installing or using Deluge
Post Reply
Sergio_Fallcone
New User
New User
Posts: 1
Joined: Thu Jul 19, 2018 9:17 am

Automatic Transfer of downloaded torrents to the desired folder. How?

Post by Sergio_Fallcone »

Good day. Tell me, is it possible to make Deluge automatically automatically transfer downloaded torrents to specific folders on a label? For example, music torrents in the Music folder, video files in the Video folder and so on. so that each time you do not select a folder when you add it. Thank you.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Automatic Transfer of downloaded torrents to the desired folder. How?

Post by mhertz »

Yes, there are two options; an automatic and a manual.

The 3'rd party plugin LabelPlus by ratanak supports auto-labeling with custom rules/filters, so you can sort between video, music and apps etc by filename extensions or reg-ex matches on torrent-name or whatever have you. Very impressive plugin and pretty much only a deluge thing, unless using advanced scripting with rtorrent(though if not seeding, you can make an execute script with this on all clients pretty much, but this is much easier to setup however).

viewtopic.php?t=42629

The other manual option, is using the built-in Label plugin, which can be enabled from the deluge preferences menu. This will let you setup custom move-completed dirs for the labels, as does the above plugin too, but this plugin needs you to manually select which label a download should have, before the auto-sorting can happen.

Note, the only "bad" thing about the LabelPlus plugin by ratanak, is that it doesn't support magnet links when using auto-labeling rules for files in the torrent(e.g. file-extensions). However, there's a tool called magnet2torrent.py by danfolkes which will convert a magnet to a torrent for you, and is a small fast python(supports both v2/v3) script needing no extra deps(it uses libtorrent's python-bindings directly for the conversion).

Instead of making a batchfile and setting that as default handler for magnets, then I added 4 small lines to the tool so that it now can simply be set as default handler for magnets, because it will then make a torrent from the magnet and directly load it into deluge and delete the temporary torrent meta-file afterwards, so this fixes the issue.

Note, there is already a fork of magnet2torrent.py by LordAro which also supports loading into client, but that still needs a batchfile because it needs extra arguments for adding the magnet.

The torrent is loaded with 'xdg-open', meaning with whatever app you've defined to be standard handler for torrent-files, so deluge in our case obviously.

https://pastebin.com/dl/pujkSz56 (Place it somewhere under PATH, make it executable, and add as handler for magnets, but not torrents which should be kept as before set to deluge)

Edit: Uploaded on gist because stupid pastebin adds cariage-returns making it fail running afterwards! Additionally, I fixed an issue with magnets without fallback trackers sometimes staying in "downloading metadata" forever. I included another version with the fix but without auto-loading into torrent-client for manual use.

https://gist.github.com/mhertz/01842039 ... 16e83dc4e4


Manual:

https://gist.github.com/mhertz/c66dcb71 ... 18003ae554
Post Reply