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:
remove.sh
Code: Select all
#!/bin/bash
torrentid="$1"
torrentname="$2"
echo $(/home/pi/scripts/copytoplex/remove.py $torrentid $torrentname) > /dev/null
and file 2:
remove.py
Code: Select all
#!/usr/bin/python
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')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
torrentid = sys.argv[1]
torrentname = sys.argv[2]
def rem_files(torrentname, torrentpath):
shutil.rmtree("/mnt/hdd/downloading/" +torrentname)
logger.info(torrentname)
rem_files(torrentname, '/mnt/hdd/downloading')
exit()
In plugin Execute, select when torrent removed and put the path to the remove.sh file, mine is /home/pi/scripts/copytoplex/remove.sh
Notice that you have to restart deluge daemon otherwise the execute plugin will not call the remove.sh 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 :
viewtopic.php?f=9&t=55680