QNAP - Transmission - FileBot

Any questions? Need some help?
Post Reply
wsti
Posts: 15
Joined: 28 Dec 2013, 20:09

QNAP - Transmission - FileBot

Post by wsti »

Hi! I'm struggling with my QNAP - transmission - filebot constellation and I have seeked help at transmission-forum, Qnap-forum and here but without any luck. =( I'm very new on Linux and SSH, but I'm learning so please bear with me here. :oops:

What I'm aiming for:
When a download is completed I want filebot to rename both series and films and then move them from my download folder to my "film and series" folder. Thats it... ...for now anyway ;)

My equipment:
Qnap TS-269L
firmware: 4.0.5
Transmission: 2.75 -b19 (installed on qnap)
Filebot: filebot_3.8_i686.ipk (installed on qnap)
JRE 6.0.22
I use terminal on my mac

My constellation (files and codes):
I have all my media on my qnap like this
Movies: "/share/Multimedia/FILMER"
Series: "/share/Multimedia/SERIER/"seasons"/"episodes""
Downloaded media: "/share/Download/transmission/completed"

I have installed filebot on my qnap and created a file that I call "fbscript.sh" and are located here:

Code: Select all

/share/myscripts2/fbscript.sh
This script lookes like this:

Code: Select all

#!/bin/sh

/opt/usr/bin/filebot -script svn:amc /share/CACHEDEV1_DATA/Download/transmission/completed -non-strict --output /share/Multimedia/ --def "seriesFormat=SERIER/{n}/{n} Season Season {s.pad(2)}/{n} - {t}
To me this code looks like it only will process series and not film, I'm I right? How


I have edited my transmission settings like this:

Code: Select all

"script-torrent-done-enabled": true, 
    "script-torrent-done-filename": "/share/myscripts2/fbscript.sh"
And my whole settings.json-file looks like this:

Code: Select all

{
    "alt-speed-down": 50, 
    "alt-speed-enabled": false, 
    "alt-speed-time-begin": 540, 
    "alt-speed-time-day": 127, 
    "alt-speed-time-enabled": false, 
    "alt-speed-time-end": 1020, 
    "alt-speed-up": 50, 
    "bind-address-ipv4": "0.0.0.0", 
    "bind-address-ipv6": "::", 
    "blocklist-enabled": true, 
    "blocklist-url": "http://www.bluetack.co.uk/config/level1.gz", 
    "cache-size-mb": 2, 
    "dht-enabled": true, 
    "download-dir": "/share/CACHEDEV1_DATA/Download/transmission/completed", 
    "download-queue-enabled": true, 
    "download-queue-size": 5, 
    "encryption": 0, 
    "idle-seeding-limit": 30, 
    "idle-seeding-limit-enabled": false, 
    "incomplete-dir": "/share/CACHEDEV1_DATA/Download/transmission/incomplete", 
    "incomplete-dir-enabled": true, 
    "lazy-bitfield-enabled": true, 
    "lpd-enabled": true, 
    "message-level": 2, 
    "open-file-limit": 32, 
    "peer-congestion-algorithm": "", 
    "peer-limit-global": 1000, 
    "peer-limit-per-torrent": 250, 
    "peer-port": 51413, 
    "peer-port-random-high": 65535, 
    "peer-port-random-low": 49152, 
    "peer-port-random-on-start": false, 
    "peer-socket-tos": "default", 
    "pex-enabled": true, 
    "port-forwarding-enabled": true, 
    "preallocation": 2, 
    "prefetch-enabled": 0, 
    "proxy": "", 
    "proxy-auth-enabled": false, 
    "proxy-auth-password": "", 
    "proxy-auth-username": "", 
    "proxy-enabled": false, 
    "proxy-port": 80, 
    "proxy-type": 0, 
    "queue-stalled-enabled": true, 
    "queue-stalled-minutes": 30, 
    "ratio-limit": 1, 
    "ratio-limit-enabled": false, 
    "rename-partial-files": true, 
    "rpc-authentication-required": true, 
    "rpc-bind-address": "0.0.0.0", 
    "rpc-enabled": true, 
    "rpc-password": "{835a668924ce6ad5f301256409a5bf92c031a149AjfzKLG3", 
    "rpc-port": 9091, 
    "rpc-url": "/transmission/", 
    "rpc-username": "admin", 
    "rpc-whitelist": "127.0.0.1", 
    "rpc-whitelist-enabled": false, 
    "scrape-paused-torrents-enabled": true, 
    "script-torrent-done-enabled": true, 
    "script-torrent-done-filename": "/share/myscripts2/fbscript.sh", 
    "seed-queue-enabled": false, 
    "seed-queue-size": 10, 
    "speed-limit-down": 0, 
    "speed-limit-down-enabled": false, 
    "speed-limit-up": 0, 
    "speed-limit-up-enabled": false, 
    "start-added-torrents": true, 
    "trash-original-torrent-files": false, 
    "umask": 0, 
    "upload-slots-per-torrent": 15, 
    "utp-enabled": true, 
    "watch-dir": "/share/CACHEDEV1_DATA/Download/transmission/watch", 
}
So I want transmission, as soon as a download is completed, to run fbscript.sh which in turn rename the downloaded file and the move it to either "/share/Multimedia/FILMER" or "/share/Multimedia/SERIER".

Is there a fundamental wrong I've done, I'm I way of?
Appreciate all the help I can get.

//W
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: QNAP - Transmission - FileBot

Post by rednoah »

I'd start by making sure your script is called.

Then I'd copy the call for the amc script verbatim:
http://www.filebot.net/forums/viewtopic ... =215#p1561

Only after you got that working you can start looking into customization. Not sure where you found svn:name, but don't use it, it won't work anymore nowadays. So ignore that call you have and use the standard example from the docs.
:idea: Please read the FAQ and How to Request Help.
wsti
Posts: 15
Joined: 28 Dec 2013, 20:09

Re: QNAP - Transmission - FileBot

Post by wsti »

rednoah wrote:I'd start by making sure your script is called.
How do I test this? Been trying to find this info as well.


//W
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: QNAP - Transmission - FileBot

Post by rednoah »

Code: Select all

echo "something" > /path/to/file
If this is called there will be a file and it's content will be something. This is about as basic as it gets. ;) Do some shell tutorials. ;)
:idea: Please read the FAQ and How to Request Help.
wsti
Posts: 15
Joined: 28 Dec 2013, 20:09

Re: QNAP - Transmission - FileBot

Post by wsti »

This is about as basic as it gets. ;) Do some shell tutorials.
Touche, still learning but probably skipped a couple of fundamental steps ;)

Okay, I've backed up a couple of steps now. I've now made a test-dir consisting the scrip (fbtm.sh) and one episode that I want to rename. I figure that if I can rename this episod by manually execute the fbtm.sh-script I probably can figure out the rest of my problems! =)

So my test dir is located in:

Code: Select all

share/test/
the fbtm.sh-file now lookes like this:

Code: Select all

#!/bin/bash
filebot -script fn:amc --output "share/test/" --log-file amc.log --action copy --conflict override -non-strict --def "seriesFormat=SERIER/{n}/{n} - {s00e00} - {t}"
I'm trying to execute the file (from share/test) like this:

Code: Select all

sh fbtm.sh
The output I get is:

Code: Select all

fbtm.sh: line 2: filebot: command not found
Could it be that filebot isn't properly installed or is it my shell-script that isn't configured properly?


//W
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: QNAP - Transmission - FileBot

Post by rednoah »

If you have PATH issues, and it almost always is PATH issues, try using the absolute path to the executable, e.g. "C:/Program Files/Filebot/filebot.exe" or "./Applications/Filebot.app/Contents/MacOS/filebot.sh"
It's important to know what the PATH is when working with cmdline. Read up on it. ;) Your shell just doesn't know where this filebot command would be coming from.
:idea: Please read the FAQ and How to Request Help.
wsti
Posts: 15
Joined: 28 Dec 2013, 20:09

Re: QNAP - Transmission - FileBot

Post by wsti »

Well, I'm getting there! =)

I got filebot to work for me now, finally (YEAY)! I still have a "test-dir" with one movie and one episod.

My script that I use lookes like this:

Code: Select all

/opt/usr/bin/filebot -script fn:amc "/share/test/" --output "/share/test" --log-file amc.log  --action copy --conflict override -non-strict --def artwork=n "seriesFormat=TV/{n}/Season {s.pad(2)}/{n} - {s00e00} - {t}" "movieFormat=Filmer/{n} - {y}"
surprise surprise, it actually works =) However, this only work local, it looks in the dir "share/test" and then puts the films and series in "share/test/..." etc.

Now when I try to get the transmission-script to work something happens (or nothing happens). The script looks like this:

Code: Select all

/opt/usr/bin/filebot -script fn:amc --output "share/Multimedia" --log-file amc.log --action copy --conflict override -non-strict --def artwork=n "seriesFormat=TV/{n}/Season {s.pad(2)}/{n} - {s00e00} - {t}" "movieFormat=Filmer/{n} - {y}"  "ut_dir=$TR_TORRENT_DIR/$TR_TORRENT_NAME" "ut_kind=multi" "ut_title=$TR_TORRENT_NAME"
question: Do I need to change anything on the parameters "ut_dir", "ut_kin" or "ut_title"?

If I try to run this script I get the output:

Code: Select all

[/share/test] # sh fbtm
Locking /opt/usr/share/filebot/data/logs/amc.log
Parameter: artwork = n
Parameter: seriesFormat = TV/{n}/Season {s.pad(2)}/{n} - {s00e00} - {t}
Parameter: movieFormat = Filmer/{n} - {y}
Parameter: ut_dir = /
Parameter: ut_kind = multi
Parameter: ut_title = 
and thats it! Will this script only work through transmission, when a download is completed?

if not...

...Would it be more plausible that the error is in transmission and its script (that looks like below) or would my error be in the script above?

Code: Select all

"script-torrent-done-enabled": true,
    "script-torrent-done-filename": "/share/CACHEDEV1_DATA/.qpkg/Transmission/scripts/run_scripts.sh",
        "script-torrent-done-filename": "/share/test/fbtm",
Getting there, hopefully! =)

//W
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: QNAP - Transmission - FileBot

Post by rednoah »

Yes, that's where these mysterious environment variables are supposed to be coming from:

Code: Select all

$TR_TORRENT_DIR/$TR_TORRENT_NAME
That's the first thing I would be testing. That transmission is in fact passing those variables along. ;) Also it is likely that you can only set one script, unless the docs say otherwise.
:idea: Please read the FAQ and How to Request Help.
wsti
Posts: 15
Joined: 28 Dec 2013, 20:09

Re: QNAP - Transmission - FileBot

Post by wsti »

rednoah wrote:Yes, that's where these mysterious environment variables are supposed to be coming from:

Code: Select all

$TR_TORRENT_DIR/$TR_TORRENT_NAME
That's the first thing I would be testing. That transmission is in fact passing those variables along. ;) Also it is likely that you can only set one script, unless the docs say otherwise.

Okay, didn't really follow you there, sorry.

Was that a "Yes, you have to change those parameters" or "No, it's suppose to work fine with those parameters"?

According to the transmission-log the scrip is calling as it should so it is definitely something wrong with my "fbtm"-script.
User avatar
rednoah
The Source
Posts: 23003
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: QNAP - Transmission - FileBot

Post by rednoah »

Of course the answer is "No, it's suppose to work fine with those parameters". How else would the script know what folder to process?

Look at the docs:
https://trac.transmissionbt.com/wiki/Sc ... Completion

First you figure out how you access these variables in your shell script. What I wrote should work, but if it doesn't it's probably because the script doesn't have the variables.
:idea: Please read the FAQ and How to Request Help.
Post Reply