rTorrent. Event not triggered, script not executed?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
whiteball
Posts: 4
Joined: 30 Nov 2014, 18:38

rTorrent. Event not triggered, script not executed?

Post by whiteball »

Hi.

First of all, thanks a lot for a nice program. I have been trying to set up AMC according to the official guide here:
viewtopic.php?f=4&t=215

I am running rTorrent on FreeBSD.

In .rtorrent.rc, I have appended the following at the bottom and restarted rTorrent several times:
system.method.set_key=event.download.finished,filebot_amc,"execute={~/rtorrent-postprocess,$d.get_base_path=,$d.get_name=,$d.get_custom1=}"

In the same folder, that is the home folder of my service account, I have created a file rtorrent-postprocess with the following content:
#!/usr/local/bin/bash
TORRENT_PATH=$1
TORRENT_NAME=$2
TORRENT_LABEL=$3

java -jar ~/FileBot/FileBot.jar -script fn:amc --output "/mnt/" --log-file amc.log --action copy --conflict override -non-strict --def artwork=y --def xbmc=htpc --def "seriesFormat=/tvshows/{n}/{'Season '+s}/{n} - {s00e00} - {t}" "ut_dir=$TORRENT_PATH" "ut_kind=multi"
"ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" &


I can run ~/rtorrent-postprocess from the terminal, but the script fails for obvious reasons (no parameters supplied). The error is written to the ~/.filebot/logs/amc.log log file.

However, rTorrent does not seem to trigger AMC. When a new download has finished, nothing seems to happen with the files and nothing is written to the ~/.filebot/logs/amc.log log file.

Any suggestions?
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rTorrent. Event not triggered, script not executed?

Post by rednoah »

Have you confirmed that the bash script is called at all?

FYI ~ is a sh construct like*that will most likely not work in other programs.

On an unrelated note. Using java -jar ~/FileBot/FileBot.jar is highly discouraged. Use filebot.sh instead. If you're using the jar, use the portable distribution instead.
:idea: Please read the FAQ and How to Request Help.
whiteball
Posts: 4
Joined: 30 Nov 2014, 18:38

Re: rTorrent. Event not triggered, script not executed?

Post by whiteball »

rednoah wrote:Have you confirmed that the bash script is called at all?

FYI ~ is a sh construct like*that will most likely not work in other programs.

On an unrelated note. Using java -jar ~/FileBot/FileBot.jar is highly discouraged. Use filebot.sh instead. If you're using the jar, use the portable distribution instead.
Hi.

I have not confirmed that the bash script is called at all, but since nothing is written to the amc.log, I assumed that it wasn't. Are there any other ways I can check?

I will use filebot.sh instead of the .jar. I do use the portable distribution, however.

Best regards.
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rTorrent. Event not triggered, script not executed?

Post by rednoah »

I'd start with just writing the current date to file or some other really really basic shell script. And use absolute paths for everything, anything that might be variable. First you eliminate anything that could go wrong, and once you have something that works, you start building from there.
:idea: Please read the FAQ and How to Request Help.
whiteball
Posts: 4
Joined: 30 Nov 2014, 18:38

Re: rTorrent. Event not triggered, script not executed?

Post by whiteball »

With absolute paths, I have managed to get the script to run - confirmed via rtorrent logging into /tmp/exec.log.

The problem seems to be that /home/user/FileBot/filebot.sh fails with the error that java is not found, even though java is installed and /home/user/FileBot/filebot.sh runs fine when run manually by the same user in the terminal. In short, I have an issue with permissions and/or path.
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rTorrent. Event not triggered, script not executed?

Post by rednoah »

Most likely the PATH. The interactive login shell is not the same as a system call by a program. Things like ~/.profile or ~/.bashrc are never executed.

When rtorrent is calling a program, it's doing just that, calling a program. It's not implicitly calling a bash and then passing a command for that bash shell to execute. Though you could do that of course.
:idea: Please read the FAQ and How to Request Help.
whiteball
Posts: 4
Joined: 30 Nov 2014, 18:38

Re: rTorrent. Event not triggered, script not executed?

Post by whiteball »

rednoah wrote:Most likely the PATH. The interactive login shell is not the same as a system call by a program. Things like ~/.profile or ~/.bashrc are never executed.

When rtorrent is calling a program, it's doing just that, calling a program. It's not implicitly calling a bash and then passing a command for that bash shell to execute. Though you could do that of course.
Ah, I see. It works now, but only because I entered the full path to java in filebot.sh.

Can you tell me if the update-filebot.sh script also reverts the filebot.sh? If yes, do you have any ideas how I can solve my problem in a more persistent way?
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rTorrent. Event not triggered, script not executed?

Post by rednoah »

It's only updating the jar, i.e. it's doing 1 curl call:

Code: Select all

cat update-filebot.sh
:idea: Please read the FAQ and How to Request Help.
Post Reply