qBittorrent -- Run external program on torrent completion

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
rp93vip
Posts: 2
Joined: 31 Aug 2021, 21:33

qBittorrent -- Run external program on torrent completion

Post by rp93vip »

Hi, I'm trying to get Filebot to run on torrent completion with qBittorrent 4.2.5 on Debian 11. I have a terminal command that works and does exactly what I want when I run it in the terminal:

Code: Select all

filebot -rename ./nas/Downloads/*.mkv -non-strict --output ./nas/TV --format "{~kodi}" -no-index -script fn:amc --log-file ./amc.log --def pushbullet=[myApiKey]
I'm basically just copying mkv files from a Downloads folder to a TV folder with appropriate naming conventions for Kodi, and then sending myself a notification. Here's the log output from a successful terminal run:

Code: Select all

Run script [fn:amc] at [Tue Aug 31 17:48:00 EDT 2021]
Parameter: pushbullet = *****
Argument[0]: /home/user/nas/Downloads/file.mkv
Input: /home/user/nas/Downloads/file.mkv
xattr: [file.mkv] => [Series - 1x01 - Episode]
Group: {Series=series name} => [file.mkv]
Rename episodes using [TheTVDB] with [Airdate]
Lookup via [Series Name]
Fetching episode data for [Series Name]
[MOVE] from [/home/user/nas/Downloads/file.mkv] to
[/home/user/nas/TV/Series Name/Season 1/Series Name - 1x01 - Episode.mkv]
Processed 1 file
Sending PushBullet report
Done ヾ(@⌒ー⌒@)ノ
However, nothing happens after torrent completion when I enter the terminal command into the "on torrent completion" box in the qBittorrent settings. Nothing is written to the log file, so I don't think Filebot is being called. Do I need to add or change something to get qBittorrent to run a terminal command?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: qBittorrent -- Run external program on torrent completion

Post by rednoah »

:?: What does the console output say when qBT is calling the command?


:?: . is the current working directory. What is the current working directory if qBT is calling this command? (HINT: it's probably not the same that your shell just so happens to currently be in)


:arrow: Please read How to debug scripts that are called by other tools? for debug advice.


:arrow: I'd start by following the instruction at [qBittorrent] Setup for Windows, Linux and Mac OS X and then customize things from there, step by step, testing every step of the way.
:idea: Please read the FAQ and How to Request Help.
rp93vip
Posts: 2
Joined: 31 Aug 2021, 21:33

Re: qBittorrent -- Run external program on torrent completion

Post by rp93vip »

Thanks for the quick reply, rednoah. In my case, qBittorrent won't run a terminal call to filebot, even when I specify the full path to filebot or strip out arguments.

After some debugging, I figured out that qBittorrent will run bash scripts, so I simply placed the terminal command into a bash script. It's now working perfectly. In the "Run external program" field in qBittorrent, I'm using:

Code: Select all

/home/user/scripts/filebot.sh
Hopefully this helps someone else if they run into the same problem. Thanks again for your help.
Post Reply