Transmission - Ubuntu - Filebot not running from script

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
domg
Posts: 5
Joined: 11 Oct 2015, 01:43

Transmission - Ubuntu - Filebot not running from script

Post by domg »

I have googled and worked on this code for so long now and still cannot get it to work. Hoping someone has some insight.

I am using ubuntu and have a script to run when a torrent is complete in transmission. Transmission runs under my user (dom) and has the same permissions as the script. I've done a whoami > log in the script and it comes up as dom so 1. I know the script is being run, and 2. it's running under "dom".

If I run the script manually, it calls filebot just fine and sorts my movies.

Here is the code:

Code: Select all

#!/bin/bash


if test "$TR_TORRENT_DIR" =  '/home/dom/Media/Unsorted/Movies'; then

        /usr/bin/filebot -script fn:amc --output "/home/dom/Media/Movies" --log-file /home/dom/.filebot/logs/amc.log --action move --conflict override -non-strict "/home/dom/Media/Unsorted/Movies" --def excludeList=/home/dom/Media/Movies/amc.txt subtitles=en,es "movieFormat=/home/dom/Media/Movies/{n.space('.')}.{y}.{vc}.{vf}" clean=y plex=127.0.0.1:xxxxxxxxx pushbullet=xxxxxxxxxxxxxxxxxxxxxxx >>/home/dom/Logs/trans-error.log 2>&1

                echo "[`date '+%Y-%m-%d %H:%M:%S'`] SCANNED MOVIE: $TR_TORRENT_NAME" >> /home/dom/Logs/trans-check.log
                exit
        else
                echo "[`date '+%Y-%m-%d %H:%M:%S'`] NOT SCANNED - Download Directory: $TR_TORRENT_DIR" >> /home/dom/Logs/trans-check.log
                exit
fi
My coding isn't the best, but like I said, the script runs fine manually. The log files I have setup do show "SCANNED MOVIE:" with the title, so I know the if statement is run.

my settings.json file is owned by dom, as well as transmission, all the folders called in the script. Filebot is also owned by dom.

I've been trying to figure this out for months now, so any info would be much appreciated!

PS. I just noticed that my amc.log file shows "/.filebot" when the script runs from transmission

Thanks
-Dom
Last edited by domg on 11 Oct 2015, 02:50, edited 1 time in total.
domg
Posts: 5
Joined: 11 Oct 2015, 01:43

Re: Transmission - Ubuntu - Filebot not running from script

Post by domg »

Code: Select all

FileBot 4.6 (r3052)
JNA Native: 4.0.0
MediaInfo: MediaInfoLib - v0.7.69
7-Zip-JBinding: OK
chromaprint-tools: fpcalc version 1.1.0 (/usr/share/filebot/fpcalc)
Extended Attributes: OK
Groovy Engine: 2.4.3
JRE: Java(TM) SE Runtime Environment 1.8.0_60 (headless)
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 8 Core / 1 GB Max Memory / 21 MB Used Memory
OS: Linux (amd64)
uname: Linux doms-server 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Done ヾ(@⌒ー⌒@)ノ
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Transmission - Ubuntu - Filebot not running from script

Post by rednoah »

So you've made sure that filebot is called? What does your /home/dom/Logs/trans-error.log say?
:idea: Please read the FAQ and How to Request Help.
domg
Posts: 5
Joined: 11 Oct 2015, 01:43

Re: Transmission - Ubuntu - Filebot not running from script

Post by domg »

Code: Select all

/.filebot
That's the only thing that shows up in that log, every time the script is run from transmission. If I run it manually, I get the standard amc output.

My trans-check.log has this

Code: Select all

[2015-10-11 14:00:10] SCANNED MOVIE: Spy (2015)
So I know the script is running past the filebot command.

Thanks for the reply
-Dom
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Transmission - Ubuntu - Filebot not running from script

Post by rednoah »

It doesn't seem like that's the complete log. You're missing something. Though looking at filebot.sh it might just be that $HOME is undefined. Make sure that $HOME is set. You might wanna make a thread in the Transmission forums how 3rd party tools are called, and what environment they're running in.
:idea: Please read the FAQ and How to Request Help.
domg
Posts: 5
Joined: 11 Oct 2015, 01:43

Re: Transmission - Ubuntu - Filebot not running from script

Post by domg »

That's all there is for that log. Every time transmission runs the script it adds /.filebot to the log.

As far as the $HOME, it needs to be defined for transmission, filebot, PATH ,or all of the above?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Transmission - Ubuntu - Filebot not running from script

Post by rednoah »

In your bash script, the one called by transmission, you should set HOME before filebot is called:

Code: Select all

export HOME=/path/to/your/user/home
:idea: Please read the FAQ and How to Request Help.
domg
Posts: 5
Joined: 11 Oct 2015, 01:43

Re: Transmission - Ubuntu - Filebot not running from script

Post by domg »

Wow. It was that easy. Thank you!!

Just for insight, what needs the home directory--I was using absolute paths for everything? Just to understand future scripts.

Thanks again!!
-Dom
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Transmission - Ubuntu - Filebot not running from script

Post by rednoah »

Open $HOME/.filebot and see for yourself. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply