Ubuntu: problem with AMC and automatic sorting

Any questions? Need some help?
Post Reply
Petta
Posts: 3
Joined: 06 Aug 2014, 23:08

Ubuntu: problem with AMC and automatic sorting

Post by Petta »

Hi all,

I've been trying to setup the AMC on my headess Ubuntu-server with rtorrent and rutorrent. I got it working with the basic code example given during the setup but been struggling for a few hours with the more advanced setup. Probably a simple mistake from my part and most likely nothing wrong with the software. Hopefully someone here will spot it or point me in the right directions.

My setup is as follows:

Code: Select all

filebot -script fn:sysinfo
FileBot 4.2 (r2326)
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.3.4
JRE: OpenJDK Runtime Environment 1.7.0_55 (headless)
JVM: 64-bit OpenJDK 64-Bit Server VM
CPU/MEM: 8 Core / 1 GB Max Memory / 65 MB Used Memory
OS: Linux (amd64)
uname: Linux rtorrent 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linu
The following setup worked for me:

Code: Select all

#!/bin/bash
TORRENT_PATH=$1
TORRENT_NAME=$2
TORRENT_LABEL=$3

filebot -script fn:amc --output "/mnt/media/Torrent/Unpacked" --log-file amc.log --action hardlink --conflict skip -non-strict --def artwork=y "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" &
The amc-log after showed the following error, if that has anything to do with it.

Code: Select all

Failed to set xattr: java.lang.IllegalStateException: java.nio.file.FileSystemException:
But I'm guessing that has something to do with the creation point is on a NFS share (ZFS/OmniOS). I couldn't at least see anything wrong, all folders and files where there as expected.

I then proceeded to add more direction on how to sort the automatic sorting instead of having everything placed in the Unpacked-folder I had created for testing earlier. I had previously fiddled with a GUI Windows installation and had a basic code from there that I then ran through the escape-tool as suggested in the guide.

Code: Select all

#!/bin/bash
TORRENT_PATH=$1
TORRENT_NAME=$2
TORRENT_LABEL=$3

filebot -script fn:amc --output "/mnt/media/Torrent/Unpacked" --log-file amc.log --action hardlink --conflict skip -non-strict --def "seriesFormat=/mnt/media/TV/{n}/{\"Season ${s.pad(2)}\"}/{n} - {s00e00} - {t}" "ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" &
But that didn't work. To my surprise I wasn't given any error message in the log or any other update whatsoever. Nothing has been written to it since the prev attempt that succeeded. Since I have no error message to go on it's a bit hard since I'm new at this.

Thanks in advance and hope my mistake is easily spotted,
Peter.
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ubuntu: problem with AMC and automatic sorting

Post by rednoah »

Have you tried running it manually and see what happens? There can't be no output. If FileBot doesn't write any logs then it means filebot wasn't called, and the script probably has some messed up arguments.

My best guess would be the $ in ${s.pad(2)} is not escaped correctly, thus interpreted by bash to do who knows what and crash.
:idea: Please read the FAQ and How to Request Help.
Petta
Posts: 3
Joined: 06 Aug 2014, 23:08

Re: Ubuntu: problem with AMC and automatic sorting

Post by Petta »

I did as you asked and you were correct, problem relies there. I had thought that your Escape-tool would fix that (hence me pointing it out) but I believe I misunderstood the use of it. Sorry for that, my mistake.

Not wanting to ask too much but I really would want to keep the format Season 01, not Season 1 as given by your examples in the guide for AMC - do you have any other suggestion on how I might achieve this? I noticed that when I ran the original script it produced me with a folder called Season 01 so I guess you have already produced the correct code for this in your script.
User avatar
rednoah
The Source
Posts: 23005
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Ubuntu: problem with AMC and automatic sorting

Post by rednoah »

I suppose I need to update the Escape Tool then. Looks like on Windows CMD $ must not be escaped while with Linux BASH $ must be escaped.

No 0-padding:

Code: Select all

{'Season '+s}
With 2-digit 0-padding:

Code: Select all

{'Season '+s.pad(2)}
:idea: Please read the FAQ and How to Request Help.
Petta
Posts: 3
Joined: 06 Aug 2014, 23:08

Re: Ubuntu: problem with AMC and automatic sorting

Post by Petta »

Thanks for all your help. Will donate a few euros shortly because I'm causing you all this trouble with my incompetence. I'm almost going mad here with all the hours put in and not getting it to work so I think the best thing is to keep you happy and not leech too much ;)

So, when I changed again as per your example above -- it worked perfectly when I ran it manually and pointed out the ut dir and title. It unpacked the file in the current location, then made a hardlink to a file in the TV-directory. I was getting very excited at this point!

But alas.. no. When I added it to my file, as below, nothing happens... no folders created, nothing unpacked, nothing in the log.

Code: Select all

#!/bin/bash
TORRENT_PATH=$1
TORRENT_NAME=$2
TORRENT_LABEL=$3

filebot -script fn:amc --output "/mnt/media/Torrent/Unpacked" --log-file amc.log --action
hardlink --conflict skip -non-strict --def "seriesFormat=/mnt/media/TV/{n}/{'Season '+s.pad(2)}/{n} - {s00e00} - {t}"
"ut_dir=$TORRENT_PATH" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL" &
Worst part is that my TV-setup should be the easy one.. sorting my movies are done with genres.contains-attribute.. :? Better make that donation a large one.. think I might be around for a while :lol:

edit: donation completed, hope you have recieved it.

edit2: I tried adding ' ' around - in {n} '-' {s00e00} '-' {t}. That didn't help. I tried adding def-- infront of "ut_dir= ...". That didn't help either.

edit3: Double-checked that the access rights were correct on all folders (even though it shouldn't matter). Re-ran chmod +rx on the rtorrent-postprocess file and also did the make sure that the user I start rtorrent is sat as owner on the TV-folder + chmod 777 (it's the same user as I have done the manual tests with so it shouldn't matter but..). This is incredible frustrating when you don't get any error messages either in logs for filebot or in rtorrent. In the end, it will probably be the silliest of mistakes..

edit4: I got it working! Well.. sort-of.. I mean, it works but not with that bash-hacking-stuff. I downloaded the amc-script from github, edited it manually instead of letting bash fecking things up, pointed the rtorrent-postprocess to that local file and voilá.. Everything works. Not I just have to figure out how to edit the amc-script for my genres under movies :) And I'm still open for any solution to my bash-failure.. Guessing that having a pointer to the github version of the script is best for updates etc.

edit5: Got genre-sorting working with movies directly, just copied the crude code I hade fixed in the Windows GUI. Groovy r0x, Bash.. not so much for us lesser creatures in this world.

edit6: I do know that it's my fault for not grasping the concept behind Bash-scripting, but I can't even add --def subtitles=en to it or any other --def (I have plex so I tried that as well). Nothing happens if I do that. Tried putting " around, like --def "subtitles=en" and that made the script work again but no subtitles were downloaded and no notification to plex. Ugh.. Will see if I can alter amc.groovy to fetch subtitles and notify plex.
Post Reply