Here's a thread providing workarounds to achieve label support for execute plugin, through utilizing custom label download/move locations and checking upon that in script to verify if from label or not:
viewtopic.php?t=50141
If on deluge1, Ult.nrg has made an enhanced version of the regular execute plugin, with various nice additions, one of which being label support:
viewtopic.php?t=54216
Additionally Cas has a branch on his private github under his deluge repo, where he added support for adding arbitrary extra status fields in optional text file which then gets appended to output as extra vars to be utilized from your script - I never tried it myself, just noticed it while peeking at his content, there's two branches regarding this btw, though this is newest:
https://github.com/cas--/Deluge/tree/Fe ... tatus-Keys (py2/gtk2 version).
Post your execute plugin scripts!
-
- New User
- Posts: 8
- Joined: Wed Apr 28, 2021 3:52 am
Re: Post your execute plugin scripts!
Post execute_plugin for 2.0.3 deluge is not showing RATIO info
my basic script.
This returns only DL, UL amount and ETA, doesn't have any info about ratio or announce url.
PS: It's for deluge 2.0.3
I wish to get RATIO number. If possible I would also like to get complete announce url.
my basic script.
Code: Select all
#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
sleep 1000
INFO=$(deluge-console -p $daemonport info $torrentid)
echo $INFO >> test.log
PS: It's for deluge 2.0.3
I wish to get RATIO number. If possible I would also like to get complete announce url.
Re: Post your execute plugin scripts!
To get same detailed output from 'info' command on deluge2 as was previously on deluge1, then add '-v' arg to 'info', and enclose in double-quotation marks(as you also reference variables additionally, and single quotes dont support shell expansion), so deluge-console don't think you're querying for version info, so "info -v $torrentid".
-
- New User
- Posts: 8
- Joined: Wed Apr 28, 2021 3:52 am
Re: Post your execute plugin scripts!
Well that worked very well thanks
search for cross seedable torrent on completion
using the excellent cross-seed app (recommended to run as a docker container)
this execute script will use cross-seed to search for similar/identical torrents on different indexers
you can also specify to only search for torrents that are downloaded to a specific directory, for example if you only want to cross seed your movies but leave your music alone.
if you don't care about specific output directories you can make it much more simple like so:
you don't need to use both name and infohash, you can just use one or the other if you want
this execute script will use cross-seed to search for similar/identical torrents on different indexers
you can also specify to only search for torrents that are downloaded to a specific directory, for example if you only want to cross seed your movies but leave your music alone.
Code: Select all
#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
if [[ $torrentpath == "/torrent/download/directory" ]] ; then
curl -XPOST http://192.168.1.100:2468/api/webhook \
--data-urlencode "infoHash=$torrentid" \
--data-urlencode "name=$torrentname" \
--data-urlencode "outputDir=/path/you/want/the/.torrent/file/downloaded/seen/from/cross-seed"
elif [[ $torrentpath == "/torrent/download/directory2" ]] ; then
curl -XPOST http://cross-seed IP:2468/api/webhook \
--data-urlencode "infoHash=$torrentid" \
--data-urlencode "name=$torrentname" \
--data-urlencode "outputDir=/path2/you/want/the/.torrent/file/downloaded/seen/from/cross-seed"
else
:
fi
Code: Select all
#!/bin/bash
torrentid=$1
torrentname=$2
curl -XPOST http://192.168.1.100:2468/api/webhook \
--data-urlencode "infoHash=$torrentid" \
--data-urlencode "name=$torrentname" \
--data-urlencode "outputDir=/path/you/want/the/.torrent/file/downloaded/seen/from/cross-seed"
-
- New User
- Posts: 3
- Joined: Thu Apr 28, 2022 7:47 pm
Re: Post your execute plugin scripts!
Looking for help for a few simple (I think) scripts, pm me please, can pay for your time but should take few seconds for anyone experienced, you guys would know best, don't really know where else to ask online. thx.
-
- New User
- Posts: 1
- Joined: Wed Oct 05, 2022 1:52 am
Re: Post your execute plugin scripts!
Here's mine, which periodically updates the tracker if there's an error with the status (after adding)... the dreaded torrent unregistered error that some trackers have.
For deluge v2+
It will write the logs to the path that the script will be saved (
Example logs
For deluge v2+
It will write the logs to the path that the script will be saved (
/path/to/script/deluge-update-tracker.log
)./path/to/script/deluge-update-tracker.sh
Code: Select all
#!/bin/bash
torrentId=$1
torrentName=$2
torrentPath=$3
# configure daemon
daemonHost=localhost
daemonPort=
daemonUser=
daemonPass=
# absolute log file path (same dir as this script)
logFilePath="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/deluge-update-tracker.log"
echo "TORRENT NAME: \"$torrentName\", ID: \"$torrentId\"" >> $logFilePath
# check connection works
$(which deluge-console) "connect $daemonHost:$daemonPort $daemonUser $daemonPass" && {
echo "CONNECTED TO: \"$(which deluge-console)\"" >> $logFilePath
} || {
echo "COULD NOT CONNECT TO: \"$(which deluge-console)\"" >> $logFilePath
exit 1
}
# wait for initial announce
echo "WAITING..." >> $logFilePath
sleep 5
i=0
while [ $i -le 10 ]; do
echo "GETTING TRACKER STATUS..." >> $logFilePath
trackerStatus=$($(which deluge-console) "connect $daemonHost:$daemonPort $daemonUser $daemonPass; info -v $torrentId" | grep "Tracker status")
echo "TRACKER STATUS: \"$trackerStatus\"" >> $logFilePath
case $trackerStatus in
# case-sensitive
*unregistered*|*unreachable*|*Sent*|*Error*|"Tracker status: ")
echo "UPDATING TRACKER..." >> $logFilePath
$(which deluge-console) "connect $daemonHost:$daemonPort $daemonUser $daemonPass; update_tracker '$torrentId'"
;;
"")
echo "INVALID TRACKER STATUS" >> $logFilePath
echo "" >> $logFilePath
exit 1
;;
*)
echo "OK TRACKER STATUS" >> $logFilePath
echo "" >> $logFilePath
exit 0
;;
esac
i=$(( $i + 1 ))
echo "WAITING..." >> $logFilePath
sleep 10
done
echo "UPDATE TRACKER DID NOT FINISH IN A TIMELY MANNER" >> $logFilePath
echo "" >> $logFilePath
Code: Select all
TORRENT NAME: "The.Great.British.Bake.Off.S13E04.WEBRip.x264-ION10", ID: "9e9524ffcd756243d0e2fe3cf42db4ccf0b2d8f0"
CONNECTED TO: "/usr/bin/deluge-console"
WAITING...
GETTING TRACKER STATUS...
TRACKER STATUS: "Tracker status: Error: skipping tracker announce (unreachable)"
UPDATING TRACKER...
WAITING...
GETTING TRACKER STATUS...
TRACKER STATUS: "Tracker status: Error: skipping tracker announce (unreachable)"
UPDATING TRACKER...
WAITING...
GETTING TRACKER STATUS...
TRACKER STATUS: "Tracker status: Announce OK"
OK TRACKER STATUS
-
- New User
- Posts: 1
- Joined: Sat Mar 16, 2024 11:16 pm
Re: Post your execute plugin scripts!
I switched to running my Deluge on windows and had to convert my "torrent ended" script from bash. I rewrote it in powershell only to discover powershell isn't one of the supported languages
viewtopic.php?t=44171
So here it is in batch. I've learnt far too much about batch in the process, would not recommend
.
What it does is pretty simple - when a torrent is finished it copies the torrent folder/file to a DESTINATION_DIR. The reason it's a bit verbose is it turns out there's a more than one command for copying files in batch, and some are better for copying single files (copy) vs folders (robocopy)
It also writes to a LOG_FILE for the start of the copy, end of the copy, and if the copy fails. :updateTimestamp is a helper function for this because it turns out just getting a nice timestamp is a whole thing in batch too
https://stackoverflow.com/a/23476347/13762264
So here it is in batch. I've learnt far too much about batch in the process, would not recommend
What it does is pretty simple - when a torrent is finished it copies the torrent folder/file to a DESTINATION_DIR. The reason it's a bit verbose is it turns out there's a more than one command for copying files in batch, and some are better for copying single files (copy) vs folders (robocopy)
It also writes to a LOG_FILE for the start of the copy, end of the copy, and if the copy fails. :updateTimestamp is a helper function for this because it turns out just getting a nice timestamp is a whole thing in batch too
Code: Select all
@echo off
set DESTINATION_DIR=C:\Users\hp\finished_torrents\
set LOG_FILE=C:/path/to/log/file/torrent_copy_bat.log
set ERROR_MESSAGE=Error! There was an error when performing the copy
set torrentid=%~1
set torrentname=%~2
set torrentpath=%~3
set srcPath=%torrentpath%\%torrentname%
set destPath=%DESTINATION_DIR%%torrentname%
set isDirectory=0
if exist %srcPath%\* (
set isDirectory=1
)
call:updateTimestamp
echo %timestamp%, %torrentid%, %isDirectory%, %srcPath%, %destPath% >> %LOG_FILE%
if %isDirectory% == 0 (
copy "%srcPath%" "%destPath%" || (
call:updateTimestamp
echo %timestamp%, %torrentid%, %ERROR_MESSAGE% >> %LOG_FILE
exit )
)
if %isDirectory% == 1 (
robocopy "%srcPath%" "%destPath%" /s /e
if %ERRORLEVEL% gtr 1 (
call:updateTimestamp
echo %timestamp%, %torrentid%, %ERROR_MESSAGE% >> %LOG_FILE%
exit
)
)
call:updateTimestamp
echo %timestamp%, %torrentid%, Copying completed :) >> %LOG_FILE%
:updateTimestamp
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set dt=%%a
set year=%dt:~0,4%
set month=%dt:~4,2%
set day=%dt:~6,2%
set hour=%dt:~8,2%
set min=%dt:~10,2%
set sec=%dt:~12,2%
set timestamp=%day%/%month%/%year% %hour%:%min%:%sec%
goto:eof