Pass torrent label as an argument in a script?

General support for problems installing or using Deluge
deckoff
Member
Member
Posts: 18
Joined: Sat Feb 25, 2012 12:03 pm

Re: Pass torrent label as an argument in a script?

Post by deckoff »

For no clear reason, the execute plugin will not trigger the script when the torrent is completed.
I am trying with the most simple script I came with:

Code: Select all

#!/bin/bash
#torrentid=blah

# LABEL=$(/home/deckoff/Desktop/getLabel.py $torrentid)

echo "blah" >> ~/Desktop/test
# echo $LABEL >> /home/deckoff/Desktop/test
This one will execute OK in terminal

This is the entry in the toorent complete field:

Code: Select all

~/Desktop/TEST.sh
and

Code: Select all

/home/deckoff/Desktop/TEST.sh
I am using thin client setup.
Any ideas how to troubleshoot - running deluge from terminal fires no errors
deckoff
Member
Member
Posts: 18
Joined: Sat Feb 25, 2012 12:03 pm

Re: Pass torrent label as an argument in a script?

Post by deckoff »

I kind of solved this.
First, I found this link:
http://forum.deluge-torrent.org/viewtop ... =9&t=38555
SO, I wrote two scripts:
wrapper:

Code: Select all

#! /bin/bash

/home/deckoff/Desktop/DS/complete $1 $2 $3 &
and
complete:

Code: Select all

#!/bin/bash

torrentid="$1"
torrentname="$2"
torrentpath="$3"

LABEL=$(/home/deckoff/Desktop/getLabel.py $torrentid)

        echo $torrentname "was downloaded, label is" $LABEL >> /home/deckoff/lastxfer.txt
My previous scripts were saved in UTf-8, current locale( Bulgarian), so I saved the new scripts in Western ISO 8859 15. I also chose new names and locations for the scripts. The script is now executed as expected. Hope this helps some one.
As long as this is working, I think I can go on from here :)
Lazybones
Leecher
Leecher
Posts: 62
Joined: Sat Dec 31, 2011 11:00 pm

Re: Pass torrent label as an argument in a script?

Post by Lazybones »

deckoff wrote:Thank you, but I don't quite understand what to do - I am new to this.
Where should the code of the shell script go , and hwo exactly do I fork it.
Thank you for the help (both of you)!!!

Something like this:

Code: Select all

{
#!/bin/bash
torrentid=$1

LABEL=$(/home/deckoff/Desktop/getLabel.py $torrentid)

echo $torrentid >> /home/deckoff/Desktop/test
echo $LABEL >> /home/deckoff/Desktop/test
}&

Code: Select all


#!/bin/bash
torrentid=$1
{
LABEL=$(/home/deckoff/Desktop/getLabel.py $torrentid)

echo $torrentid >> /home/deckoff/Desktop/test
echo $LABEL >> /home/deckoff/Desktop/test
}&
Your later solution of using a calling script also works
Post Reply