Call AMC on only the torrent that was completed.

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
joel32724
Posts: 4
Joined: 20 Aug 2016, 19:47

Call AMC on only the torrent that was completed.

Post by joel32724 »

Hey Everyone,

Here is my process:
---------
1. Sickrage or Manual add torrent to Deluge.
2. Execute Plugin -> On Torrent Complete execute: /home/joel/deluge-postprocess.sh
3. deluge-postprocess.sh:

Code: Select all

#!/bin/sh -xu

# Input Parameters
ARG_PATH="$3/$2"
ARG_NAME="$2"
ARG_LABEL="N/A"

# Configuration
CONFIG_OUTPUT="/mnt/media/complete" # if this script is called by the deluge user, then $HOME will NOT refer to YOUR user home, but paths such as /var/lib/deluge instead

sleep 120s

filebot -script fn:amc --log-file amc.log --def excludeList="amc.txt" subtitles=en "/mnt/media/downloads" --output "/mnt/media/complete" --action copy -non-strict --def skipExtract=n --def deleteAfterExtract=n --def exec="echo {quote f}" --conflict auto

This works great when I am downloading one torrent at a time. The problem I am experiencing now happens if I have multiple torrents downloading at once. As soon as one finishes, it will call the script and filebot will process them both. I end up with a lot of incomplete copies of files this way.

Is there a way to make filebot process only the folder of the completed torrent? IE /mnt/media/downloads/%torrentthatjustfinisheddownloading%

I've been rethinking my whole setup as well, so any suggestions to a good guide for Sickrage, Plex and Deluge(or something else) would be appreciated.

Thanks,

Joel
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Call AMC on only the torrent that was completed.

Post by rednoah »

1.
FileBot will only process the files you pass in via command-line arguments. If you can make SickRage/Deluge give you exactly those file paths (and not just the download folder) then it'd be easy.

In your case, it'll process everything in "/mnt/media/downloads" because you explicitly pass in that folder as input argument.


2.
The deluge example integration should work by default, because Deluge is passing in download folder and torrent name via command-line arguments:

Code: Select all

ARG_PATH="$3/$2"
@see https://github.com/filebot/plugins/blob ... process.sh
:idea: Please read the FAQ and How to Request Help.
joel32724
Posts: 4
Joined: 20 Aug 2016, 19:47

Re: Call AMC on only the torrent that was completed.

Post by joel32724 »

So instead of using:

Code: Select all

filebot -script fn:amc --log-file amc.log --def excludeList="amc.txt" subtitles=en "/mnt/media/downloads" --output "/mnt/media/complete" --action copy -non-strict --def skipExtract=n --def deleteAfterExtract=n --def exec="echo {quote f}" --conflict auto
I should use:

Code: Select all

filebot -script fn:amc --log-file amc.log --def excludeList="amc.txt" subtitles=en --def ut_dir="$ARG_PATH" --output "/mnt/media/complete" --action copy -non-strict --def skipExtract=n --def deleteAfterExtract=n --def exec="echo {quote f}" --conflict auto
Forgive my ignorance, still pretty new to scripting and linux.

Thanks
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Call AMC on only the torrent that was completed.

Post by rednoah »

Yes, provided that $ARG_PATH is just the path to the completed file or folder.
:idea: Please read the FAQ and How to Request Help.
joel32724
Posts: 4
Joined: 20 Aug 2016, 19:47

Re: Call AMC on only the torrent that was completed.

Post by joel32724 »

That's what it was. It's working great now. Thanks!

Joel
Post Reply