running a script from transmission doesn't work

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
dekox
Posts: 5
Joined: 28 Mar 2015, 00:54

running a script from transmission doesn't work

Post by dekox »

Hi all,

First, let me say that this is truly an amazing program! I've been all excited about it for the past week, but the problem is that I am trying to get transmission to execute a script upon finishing a download, but nothing seems to happen. I know that the script is called from the transmission log file:

Code: Select all

[2015-03-28 22:58:05.483 CET] torrentname.mp4 Calling script "/share/HDA_DATA/.qpkg/Transmission/scripts/transmission-postprocess.sh" (torrent.c:2119)
But nothing seems to happen after that, and nothing appears in the amc.log file.

Here is what is written in the transmission config file:

Code: Select all

    "script-torrent-done-enabled": true, 
    "script-torrent-done-filename": "/share/HDA_DATA/.qpkg/Transmission/scripts/transmission-postprocess.sh", 
Here is the code for my transmission-postprocess.sh file (which I have chmod +rx)

Code: Select all

#!/bin/bash
filebot -script fn:amc --output "/share/HDA_DATA/Multimedia" --log-file amc.log --action duplicate --conflict auto -non-strict --def artwork=y --def excludeList=amc.txt --def subtitles=en --def artwork=y --def xbmc=xxxx	 --def gmail=xxxx:xxxx --def unsorted=y --def clean=y --def deleteAfterExtract=y "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
Does anybody know what I am doing wrong here? Let me know if you need any other information.

filebot_4.5.6_arm
transmission 2.84 for QNAP NAS
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: running a script from transmission doesn't work

Post by rednoah »

1) Your script is called. FileBot is not called.

2) Have you tried calling filebot manually to see some output?

3) Have you tried redirecting output in your transmission-postprocess.sh script to see the output? Standard output AND error output.
:idea: Please read the FAQ and How to Request Help.
dekox
Posts: 5
Joined: 28 Mar 2015, 00:54

Re: running a script from transmission doesn't work

Post by dekox »

1) Yes exactly

2)When I call filebot manually from the command line it works fine. Running the script manually also works, but results in an error because it is not called by transmission and therefore can't interpret transmission supplied parameters.

Code: Select all

[/share/HDA_DATA/.qpkg/Transmission/scripts] # sh transmission-postprocess.sh
Locking /opt/share/filebot/data/logs/amc.log
Parameter: artwork = y
Parameter: excludeList = amc.txt
Parameter: subtitles = en
Parameter: xbmc = xxxx
Parameter: gmail = *****
Parameter: unsorted = y
Parameter: clean = y
Parameter: deleteAfterExtract = y
Parameter: ut_dir = /
Parameter: ut_kind = multi
Parameter: ut_title = 
Invalid arguments: pass in either file arguments or ut_dir/ut_file parameters but not both
Failure (°_°)
3) I don't understand what you mean here. What do you mean by redirecting the output in the transmission-portprocess.sh script?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: running a script from transmission doesn't work

Post by rednoah »

1.
:arrow: Please read the manual for the amc script • Automated Media Center • first.
If something is not working, first read the Notes above, then just run the command manually in new cmd window and see what happens. You CANNOT just copy & paste the template for µTorrent with all the %D, %F, etc variables into cmd. The variables have to be replaced with actual values first.
Since we agree that FileBot is never called, why do we keep testing FileBot anyway? It's obviously running, you're just calling it wrong.


2.
:arrow: Please read • How to 'Request Help' • first.
When redirecting console output, make sure to include standard output AND error output. I will not fix your command not found issues.
You redirect stdout and stderr of your script (or the filebot call) and see what it says. Most likely it'll say "java: command not found" because deluge is running with a different user that doesn't have java in the $PATH.
:idea: Please read the FAQ and How to Request Help.
dekox
Posts: 5
Joined: 28 Mar 2015, 00:54

Re: running a script from transmission doesn't work

Post by dekox »

Alright, I added > out.txt 2>err.txt to my script, and at first I thought that nothing was happening, as the the two txt files would not appear in the same directory as the .sh file. However, I think that instead they appeared in the root folder, and the following error appears when transmission runs the script:

Code: Select all

/opt/bin/filebot: line 7: java: command not found
What does this mean?
dekox
Posts: 5
Joined: 28 Mar 2015, 00:54

Re: running a script from transmission doesn't work

Post by dekox »

OK, fair enough, I should have googled it... :?
I'm still confused, though. If my understanding is correct, this is a problem with the PATH variable. But why doesn't this problem arise when I run filebot from the command line? Is the PATH variable user-specific?

Apparently my PATH is fine when I'm logged in with my usual username, so the solution to change the PATH variable that I find online wouldn't apply, or is my reasoning wrong?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: running a script from transmission doesn't work

Post by rednoah »

Yes. The PATH may be different per user, but it all depends on your setup. I recommend linking java to /usr/local/bin. This is basic Linux stuff so you should find plenty of help online. And in the forums here.
:idea: Please read the FAQ and How to Request Help.
dekox
Posts: 5
Joined: 28 Mar 2015, 00:54

Re: running a script from transmission doesn't work

Post by dekox »

I finally did it!!! :lol: :lol: :lol:

I was able to solve it by running the following command:

Code: Select all

ln -s /path/to/jre/bin/java /usr/local/bin/java
replace the /path/to/jre/bin/jva by what you get when you run

Code: Select all

which java
Thank you for being so patient rednoah! I literally had nightmares (coding nightmares woke me up in the middle of the night a couple of days ago), but I did it!!!
Post Reply