User Tools

Site Tools


config:deluge

Deluge execute script

To have files moved to various locations and a gnome alert issued when done, use the following script:

#!/bin/bash

# Use the execute plugin in Deluge
# http://dev.deluge-torrent.org/wiki/Plugins/Execute
# create a "Torrent Complete" script execution with the current script.

shopt -s nocasematch

torrentid=$1
torrentname=$2
torrentpath=$3
logfile="/home/wuff/.deluge/execute_script.log"

if [ -f "$torrentpath/$torrentname" ]
then
        echo "     Torrent is a single file" >> $logfile
else
        echo "     Torrent is a folder" >> $logfile
        #lftp -u $USER,$PASS $HOST -e "mirror -P4 -R \"$torrentpath/$torrentname\" /Storage/UbuntuISO/; quit" &>> $logfile
        if [ -f "$torrentpath/$torrentname/RARBG.com.txt" ]
        then
                echo "deleting RARBG text file" >> $logfile
                rm $torrentpath/$torrentname/RARBG.com.txt
        fi
        if [ -f "$torrentpath/$torrentname/RARBG.com.mp4" ]
        then
                echo "deleting RARBG video file" >> $logfile
                rm $torrentpath/$torrentname/RARBG.com.mp4
        fi
        if [ -d "$torrentpath/$torrentname/Sample" ]
        then
                echo "deleting Sample directory" >> $logfile
                rm -rf $torrentpath/$torrentname/Sample
        fi
        if [ -d "$torrentpath/$torrentname/sample" ]
        then
                echo "deleting sample directory" >> $logfile
                rm -rf $torrentpath/$torrentname/sample
        fi

fi
echo "Torrent Details: Name: $torrentname Path: $torrentpath ID: $torrentid" >> $logfile
#zenity on debian hangs, thus using this workaround to send the process into the background and kill it
zenity --notification --text "Torrent download complete: $torrentname" & kill $!
config/deluge.txt · Last modified: 2023/05/29 11:55 by 127.0.0.1