Delete all foder content of torrent

Suggest, post, or discuss plugins for Deluge
New User
New User
Posts: 2
Joined: Thu May 07, 2020 8:03 pm

Delete all foder content of torrent

Postby themsk » Thu May 07, 2020 8:25 pm

This can be useful to some guys that like things to be automated, on a seed box on linux or distributions of it
As we know, deluge cant delete folders that have files added by other way than thru download by torrent. Like subtitles, you downloaded a show and then added in that folder the subtitles founded on other site. Deluge will delete only the files from torrent and the folder will remain with the files you added.
So, lets use the plugin Execute, this plugin let us use a command when something happen to a torrent, eg, added, completed, removed.
We will use when torrent removed (the remove can be made manual or by another plugin like AutoRemovePlus)
The files:
file 1:

Code: Select all

echo $(/home/pi/scripts/copytoplex/ $torrentid $torrentname) > /dev/null

please change the path for with your file location
and file 2:

Code: Select all


import sys, os, fnmatch, re, shutil, logging
import stat

logger = logging.getLogger('copytoplex')
hdlr = logging.FileHandler('/home/pi/scripts/copytoplex/remove.log')
formatter = logging.Formatter('%(asctime)s %(message)s')

torrentid = sys.argv[1]
torrentname = sys.argv[2]

def rem_files(torrentname, torrentpath):
    shutil.rmtree("/mnt/hdd/downloading/" +torrentname)

rem_files(torrentname, '/mnt/hdd/downloading')

as you can see in the script, my downloaded files are in /mnt/hdd/downloading , so, change this with your folder of downloaded files and also, change the path of this files in the script.

In plugin Execute, select when torrent removed and put the path to the file, mine is /home/pi/scripts/copytoplex/

Notice that you have to restart deluge daemon otherwise the execute plugin will not call the script.
A remove.log file will be created containing the torrent name that have been removed.
Now, with the AutoRemovePlus, Execute plugins and this simple script, you can forgot about your torrents..

Also, see this tool to copy your cleaned content to Plex library :

Return to “Plugins”

Who is online

Users browsing this forum: No registered users and 4 guests